home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / i960 / i960.md < prev    next >
Text File  |  1995-06-15  |  77KB  |  2,593 lines

  1. ;;- Machine description for Intel 80960 chip for GNU C compiler
  2. ;;   Copyright (C) 1992 Free Software Foundation, Inc.
  3. ;;   Contributed by Steven McGeady, Intel Corp.
  4. ;;   Additional work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
  5. ;;   Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
  6.  
  7. ;; This file is part of GNU CC.
  8.  
  9. ;; GNU CC is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; GNU CC is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;; GNU General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU CC; see the file COPYING.  If not, write to
  21. ;; the Free Software Foundation, 59 Temple Place - Suite 330,
  22. ;; Boston, MA 02111-1307, USA.
  23.  
  24. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  25.  
  26. ;; There are very few (4) 'f' registers, they can't be loaded/stored from/to
  27. ;; memory, and some instructions explicitly require them, so we get better
  28. ;; code by discouraging pseudo-registers from being allocated to them.
  29. ;; However, we do want to allow all patterns which can store to them to
  30. ;; include them in their constraints, so we always use '*f' in a destination
  31. ;; constraint except when 'f' is the only alternative.
  32.  
  33. ;; Insn attributes which describe the i960.
  34.  
  35. ;; Modscan is not used, since the compiler never emits any of these insns.
  36. (define_attr "type"
  37.   "move,arith,alu2,mult,div,modscan,load,store,branch,call,address,compare,fpload,fpstore,fpmove,fpcvt,fpcc,fpadd,fpmul,fpdiv,multi,misc"
  38.   (const_string "arith"))
  39.  
  40. ;; Length (in # of insns).
  41. (define_attr "length" ""
  42.   (cond [(eq_attr "type" "load,fpload")
  43.           (if_then_else (match_operand 1 "symbolic_memory_operand" "")
  44.                 (const_int 2)
  45.                 (const_int 1))
  46.      (eq_attr "type" "store,fpstore")
  47.           (if_then_else (match_operand 0 "symbolic_memory_operand" "")
  48.                 (const_int 2)
  49.                 (const_int 1))
  50.      (eq_attr "type" "address")
  51.           (const_int 2)]
  52.     (const_int 1)))
  53.  
  54. (define_asm_attributes
  55.   [(set_attr "length" "1")
  56.    (set_attr "type" "multi")])
  57.  
  58. ;; (define_function_unit {name} {num-units} {n-users} {test}
  59. ;;                       {ready-delay} {issue-delay} [{conflict-list}])
  60.  
  61. ;; The integer ALU
  62. (define_function_unit "alu" 2 0 (eq_attr "type" "arith,compare,move,address") 1 0)
  63. (define_function_unit "alu" 2 0 (eq_attr "type" "alu2") 2 0)
  64. (define_function_unit "alu" 2 0 (eq_attr "type" "mult") 5 0)
  65. (define_function_unit "alu" 2 0 (eq_attr "type" "div") 35 0)
  66. (define_function_unit "alu" 2 0 (eq_attr "type" "modscan") 3 0)
  67.  
  68. ;; Memory with load-delay of 1 (i.e., 2 cycle load).
  69. (define_function_unit "memory" 1 0 (eq_attr "type" "load,fpload") 2 0)
  70.  
  71. ;; Floating point operations.
  72. (define_function_unit "fp" 1 2 (eq_attr "type" "fpmove") 5 0)
  73. (define_function_unit "fp" 1 2 (eq_attr "type" "fpcvt") 35 0)
  74. (define_function_unit "fp" 1 2 (eq_attr "type" "fpcc") 10 0)
  75. (define_function_unit "fp" 1 2 (eq_attr "type" "fpadd") 10 0)
  76. (define_function_unit "fp" 1 2 (eq_attr "type" "fpmul") 20 0)
  77. (define_function_unit "fp" 1 2 (eq_attr "type" "fpdiv") 35 0)
  78.  
  79. ;; Compare instructions.
  80. ;; This controls RTL generation and register allocation.
  81.  
  82. ;; We generate RTL for comparisons and branches by having the cmpxx 
  83. ;; patterns store away the operands.  Then, the scc and bcc patterns
  84. ;; emit RTL for both the compare and the branch.
  85. ;;
  86. ;; We start with the DEFINE_EXPANDs, then then DEFINE_INSNs to match
  87. ;; the patterns.  Finally, we have the DEFINE_SPLITs for some of the scc
  88. ;; insns that actually require more than one machine instruction.
  89.  
  90. ;; Put cmpsi first because it is expected to be the most common.
  91.  
  92. (define_expand "cmpsi"
  93.   [(set (reg:CC 36)
  94.     (compare:CC (match_operand:SI 0 "nonimmediate_operand" "")
  95.             (match_operand:SI 1 "general_operand" "")))]
  96.   ""
  97.   "
  98. {
  99.   i960_compare_op0 = operands[0];
  100.   i960_compare_op1 = operands[1];
  101.   DONE;
  102. }")
  103.  
  104. (define_expand "cmpdf"
  105.   [(set (reg:CC 36)
  106.     (compare:CC (match_operand:DF 0 "register_operand" "r")
  107.             (match_operand:DF 1 "nonmemory_operand" "rGH")))]
  108.   "TARGET_NUMERICS"
  109.   "
  110. {
  111.   i960_compare_op0 = operands[0];
  112.   i960_compare_op1 = operands[1];
  113.   DONE;
  114. }")
  115.  
  116. (define_expand "cmpsf"
  117.   [(set (reg:CC 36)
  118.     (compare:CC (match_operand:SF 0 "register_operand" "r")
  119.             (match_operand:SF 1 "nonmemory_operand" "rGH")))]
  120.   "TARGET_NUMERICS"
  121.   "
  122. {
  123.   i960_compare_op0 = operands[0];
  124.   i960_compare_op1 = operands[1];
  125.   DONE;
  126. }")
  127.  
  128. ;; Now the DEFINE_INSNs for the compare and scc cases.  First the compares.
  129.  
  130. (define_insn ""
  131.   [(set (reg:CC 36)
  132.     (compare:CC (match_operand:SI 0 "register_operand" "d")
  133.             (match_operand:SI 1 "arith_operand" "dI")))]
  134.   ""
  135.   "cmpi    %0,%1"
  136.   [(set_attr "type" "compare")])
  137.  
  138. (define_insn ""
  139.   [(set (reg:CC_UNS 36)
  140.     (compare:CC_UNS (match_operand:SI 0 "register_operand" "d")
  141.             (match_operand:SI 1 "arith_operand" "dI")))]
  142.   ""
  143.   "cmpo    %0,%1"
  144.   [(set_attr "type" "compare")])
  145.  
  146. (define_insn ""
  147.   [(set (reg:CC 36)
  148.     (compare:CC (match_operand:DF 0 "register_operand" "r")
  149.             (match_operand:DF 1 "nonmemory_operand" "rGH")))]
  150.   "TARGET_NUMERICS"
  151.   "cmprl %0,%1"
  152.   [(set_attr "type" "fpcc")])
  153.  
  154. (define_insn ""
  155.   [(set (reg:CC 36)
  156.     (compare:CC (match_operand:SF 0 "register_operand" "r")
  157.             (match_operand:SF 1 "nonmemory_operand" "rGH")))]
  158.   "TARGET_NUMERICS"
  159.   "cmpr %0,%1"
  160.   [(set_attr "type" "fpcc")])
  161.  
  162. ;; Instruction definitions for branch-on-bit-set and clear insns.
  163.  
  164. (define_insn ""
  165.   [(set (pc)
  166.     (if_then_else
  167.      (ne (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
  168.                   (const_int 1)
  169.                   (match_operand:SI 2 "arith_operand" "dI"))
  170.          (const_int 0))
  171.      (label_ref (match_operand 3 "" ""))
  172.      (pc)))]
  173.   ""
  174.   "bbs    %2,%1,%l3"
  175.   [(set_attr "type" "branch")])
  176.  
  177. (define_insn ""
  178.   [(set (pc)
  179.     (if_then_else
  180.      (eq (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
  181.                   (const_int 1)
  182.                   (match_operand:SI 2 "arith_operand" "dI"))
  183.          (const_int 0))
  184.      (label_ref (match_operand 3 "" ""))
  185.      (pc)))]
  186.   ""
  187.   "bbc    %2,%1,%l3"
  188.   [(set_attr "type" "branch")])
  189.  
  190. (define_insn ""
  191.   [(set (pc)
  192.     (if_then_else
  193.      (ne (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
  194.                   (const_int 1)
  195.                   (match_operand:SI 2 "arith_operand" "dI"))
  196.          (const_int 0))
  197.      (label_ref (match_operand 3 "" ""))
  198.      (pc)))]
  199.   ""
  200.   "bbs    %2,%1,%l3"
  201.   [(set_attr "type" "branch")])
  202.  
  203. (define_insn ""
  204.   [(set (pc)
  205.     (if_then_else
  206.      (eq (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
  207.                   (const_int 1)
  208.                   (match_operand:SI 2 "arith_operand" "dI"))
  209.          (const_int 0))
  210.      (label_ref (match_operand 3 "" ""))
  211.      (pc)))]
  212.   ""
  213.   "bbc    %2,%1,%l3"
  214.   [(set_attr "type" "branch")])
  215.  
  216. ;; ??? These will never match.  The LOG_LINKs necessary to make these match
  217. ;; are not created by flow.  These remain as a reminder to make this work
  218. ;; some day.
  219.  
  220. (define_insn ""
  221.   [(set (reg:CC 36)
  222.     (compare (match_operand:SI 0 "arith_operand" "d")
  223.          (match_operand:SI 1 "arith_operand" "d")))
  224.    (set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))]
  225.   "0"
  226.   "cmpinci    %0,%1"
  227.   [(set_attr "type" "compare")])
  228.  
  229. (define_insn ""
  230.   [(set (reg:CC_UNS 36)
  231.     (compare (match_operand:SI 0 "arith_operand" "d")
  232.          (match_operand:SI 1 "arith_operand" "d")))
  233.    (set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))]
  234.   "0"
  235.   "cmpinco    %0,%1"
  236.   [(set_attr "type" "compare")])
  237.  
  238. (define_insn ""
  239.   [(set (reg:CC 36)
  240.     (compare (match_operand:SI 0 "arith_operand" "d")
  241.          (match_operand:SI 1 "arith_operand" "d")))
  242.    (set (match_dup 1) (minus:SI (match_dup 1) (const_int 1)))]
  243.   "0"
  244.   "cmpdeci    %0,%1"
  245.   [(set_attr "type" "compare")])
  246.  
  247. (define_insn ""
  248.   [(set (reg:CC_UNS 36)
  249.     (compare (match_operand:SI 0 "arith_operand" "d")
  250.          (match_operand:SI 1 "arith_operand" "d")))
  251.    (set (match_dup 1) (minus:SI (match_dup 1) (const_int 1)))]
  252.   "0"
  253.   "cmpdeco    %0,%1"
  254.   [(set_attr "type" "compare")])
  255.  
  256. ;; Templates to store result of condition.
  257. ;; '1' is stored if condition is true.
  258. ;; '0' is stored if condition is false.
  259. ;; These should use predicate "general_operand", since
  260. ;; gcc seems to be creating mem references which use these
  261. ;; templates.
  262.  
  263. (define_expand "seq"
  264.   [(set (match_operand:SI 0 "general_operand" "=d")
  265.     (eq:SI (match_dup 1) (const_int 0)))]
  266.   ""
  267.   "
  268. {
  269.   operands[1] = gen_compare_reg (EQ, i960_compare_op0, i960_compare_op1);
  270. }")
  271.  
  272. (define_expand "sne"
  273.   [(set (match_operand:SI 0 "general_operand" "=d")
  274.     (ne:SI (match_dup 1) (const_int 0)))]
  275.   ""
  276.   "
  277. {
  278.   operands[1] = gen_compare_reg (NE, i960_compare_op0, i960_compare_op1);
  279. }")
  280.  
  281. (define_expand "sgt"
  282.   [(set (match_operand:SI 0 "general_operand" "=d")
  283.     (gt:SI (match_dup 1) (const_int 0)))]
  284.   ""
  285.   "
  286. {
  287.   operands[1] = gen_compare_reg (GT, i960_compare_op0, i960_compare_op1);
  288. }")
  289.  
  290. (define_expand "sgtu"
  291.   [(set (match_operand:SI 0 "general_operand" "=d")
  292.     (gtu:SI (match_dup 1) (const_int 0)))]
  293.   ""
  294.   "
  295. {
  296.   operands[1] = gen_compare_reg (GTU, i960_compare_op0, i960_compare_op1);
  297. }")
  298.  
  299. (define_expand "slt"
  300.   [(set (match_operand:SI 0 "general_operand" "=d")
  301.     (lt:SI (match_dup 1) (const_int 0)))]
  302.   ""
  303.   "
  304. {
  305.   operands[1] = gen_compare_reg (LT, i960_compare_op0, i960_compare_op1);
  306. }")
  307.  
  308. (define_expand "sltu"
  309.   [(set (match_operand:SI 0 "general_operand" "=d")
  310.     (ltu:SI (match_dup 1) (const_int 0)))]
  311.   ""
  312.   "
  313. {
  314.   operands[1] = gen_compare_reg (LTU, i960_compare_op0, i960_compare_op1);
  315. }")
  316.  
  317. (define_expand "sge"
  318.   [(set (match_operand:SI 0 "general_operand" "=d")
  319.     (ge:SI (match_dup 1) (const_int 0)))]
  320.   ""
  321.   "
  322. {
  323.   operands[1] = gen_compare_reg (GE, i960_compare_op0, i960_compare_op1);
  324. }")
  325.  
  326. (define_expand "sgeu"
  327.   [(set (match_operand:SI 0 "general_operand" "=d")
  328.     (geu:SI (match_dup 1) (const_int 0)))]
  329.   ""
  330.   "
  331. {
  332.   operands[1] = gen_compare_reg (GEU, i960_compare_op0, i960_compare_op1);
  333. }")
  334.  
  335. (define_expand "sle"
  336.   [(set (match_operand:SI 0 "general_operand" "=d")
  337.     (le:SI (match_dup 1) (const_int 0)))]
  338.   ""
  339.   "
  340. {
  341.   operands[1] = gen_compare_reg (LE, i960_compare_op0, i960_compare_op1);
  342. }")
  343.  
  344. (define_expand "sleu"
  345.   [(set (match_operand:SI 0 "general_operand" "=d")
  346.     (leu:SI (match_dup 1) (const_int 0)))]
  347.   ""
  348.   "
  349. {
  350.   operands[1] = gen_compare_reg (LEU, i960_compare_op0, i960_compare_op1);
  351. }")
  352.  
  353. (define_insn ""
  354.   [(set (match_operand:SI 0 "general_operand" "=d")
  355.     (match_operator:SI 1 "comparison_operator" [(reg:CC 36) (const_int 0)]))]
  356.   ""
  357.   "test%C1    %0"
  358.   [(set_attr "type" "compare")])
  359.  
  360. (define_insn ""
  361.   [(set (match_operand:SI 0 "general_operand" "=d")
  362.     (match_operator:SI 1 "comparison_operator" [(reg:CC_UNS 36) (const_int 0)]))]
  363.   ""
  364.   "test%C1    %0"
  365.   [(set_attr "type" "compare")])
  366.  
  367. ;; These control RTL generation for conditional jump insns
  368. ;; and match them for register allocation.
  369.  
  370. (define_expand "beq"
  371.   [(set (pc)
  372.     (if_then_else (eq (match_dup 1)
  373.               (const_int 0))
  374.               (label_ref (match_operand 0 "" ""))
  375.               (pc)))]
  376.   ""
  377.   "
  378. { operands[1] = gen_compare_reg (EQ, i960_compare_op0, i960_compare_op1); }")
  379.  
  380. (define_expand "bne"
  381.   [(set (pc)
  382.     (if_then_else (ne (match_dup 1)
  383.               (const_int 0))
  384.               (label_ref (match_operand 0 "" ""))
  385.               (pc)))]
  386.   ""
  387.   "
  388. { operands[1] = gen_compare_reg (NE, i960_compare_op0, i960_compare_op1); }")
  389.  
  390. (define_expand "bgt"
  391.   [(set (pc)
  392.     (if_then_else (gt (match_dup 1)
  393.               (const_int 0))
  394.               (label_ref (match_operand 0 "" ""))
  395.               (pc)))]
  396.   ""
  397.   "
  398. { operands[1] = gen_compare_reg (GT, i960_compare_op0, i960_compare_op1); }")
  399.  
  400. (define_expand "bgtu"
  401.   [(set (pc)
  402.     (if_then_else (gtu (match_dup 1)
  403.                (const_int 0))
  404.               (label_ref (match_operand 0 "" ""))
  405.               (pc)))]
  406.   ""
  407.   "
  408. { operands[1] = gen_compare_reg (GTU, i960_compare_op0, i960_compare_op1); }")
  409.  
  410. (define_expand "blt"
  411.   [(set (pc)
  412.     (if_then_else (lt (match_dup 1)
  413.               (const_int 0))
  414.               (label_ref (match_operand 0 "" ""))
  415.               (pc)))]
  416.   ""
  417.   "
  418. { operands[1] = gen_compare_reg (LT, i960_compare_op0, i960_compare_op1); }")
  419.  
  420. (define_expand "bltu"
  421.   [(set (pc)
  422.     (if_then_else (ltu (match_dup 1)
  423.                (const_int 0))
  424.               (label_ref (match_operand 0 "" ""))
  425.               (pc)))]
  426.   ""
  427.   "
  428. { operands[1] = gen_compare_reg (LTU, i960_compare_op0, i960_compare_op1); }")
  429.  
  430. (define_expand "bge"
  431.   [(set (pc)
  432.     (if_then_else (ge (match_dup 1)
  433.               (const_int 0))
  434.               (label_ref (match_operand 0 "" ""))
  435.               (pc)))]
  436.   ""
  437.   "
  438. { operands[1] = gen_compare_reg (GE, i960_compare_op0, i960_compare_op1); }")
  439.  
  440. (define_expand "bgeu"
  441.   [(set (pc)
  442.     (if_then_else (geu (match_dup 1)
  443.                (const_int 0))
  444.               (label_ref (match_operand 0 "" ""))
  445.               (pc)))]
  446.   ""
  447.   "
  448. { operands[1] = gen_compare_reg (GEU, i960_compare_op0, i960_compare_op1); }")
  449.  
  450. (define_expand "ble"
  451.   [(set (pc)
  452.     (if_then_else (le (match_dup 1)
  453.               (const_int 0))
  454.               (label_ref (match_operand 0 "" ""))
  455.               (pc)))]
  456.   ""
  457.   "
  458. { operands[1] = gen_compare_reg (LE, i960_compare_op0, i960_compare_op1); }")
  459.  
  460. (define_expand "bleu"
  461.   [(set (pc)
  462.     (if_then_else (leu (match_dup 1)
  463.                (const_int 0))
  464.               (label_ref (match_operand 0 "" ""))
  465.               (pc)))]
  466.   ""
  467.   "
  468. { operands[1] = gen_compare_reg (LEU, i960_compare_op0, i960_compare_op1); }")
  469.  
  470. ;; Now the normal branch insns (forward and reverse).
  471.  
  472. (define_insn ""
  473.   [(set (pc)
  474.     (if_then_else (match_operator 0 "comparison_operator"
  475.                       [(reg:CC 36) (const_int 0)])
  476.               (label_ref (match_operand 1 "" ""))
  477.               (pc)))]
  478.   ""
  479.   "b%C0 %l1"
  480.   [(set_attr "type" "branch")])
  481.  
  482. (define_insn ""
  483.   [(set (pc)
  484.     (if_then_else (match_operator 0 "comparison_operator"
  485.                       [(reg:CC 36) (const_int 0)])
  486.               (pc)
  487.               (label_ref (match_operand 1 "" ""))))]
  488.   ""
  489.   "b%I0 %l1"
  490.   [(set_attr "type" "branch")])
  491.  
  492. (define_insn ""
  493.   [(set (pc)
  494.     (if_then_else (match_operator 0 "comparison_operator"
  495.                       [(reg:CC_UNS 36) (const_int 0)])
  496.               (label_ref (match_operand 1 "" ""))
  497.               (pc)))]
  498.   ""
  499.   "b%C0 %l1"
  500.   [(set_attr "type" "branch")])
  501.  
  502. (define_insn ""
  503.   [(set (pc)
  504.     (if_then_else (match_operator 0 "comparison_operator"
  505.                       [(reg:CC_UNS 36) (const_int 0)])
  506.               (pc)
  507.               (label_ref (match_operand 1 "" ""))))]
  508.   ""
  509.   "b%I0 %l1"
  510.   [(set_attr "type" "branch")])
  511.  
  512. (define_insn ""
  513.   [(set (pc)
  514.     (if_then_else
  515.      (match_operator 0 "comparison_operator"
  516.              [(match_operand:SI 1 "arith_operand" "d")
  517.               (match_operand:SI 2 "arith_operand" "dI")])
  518.      (label_ref (match_operand 3 "" ""))
  519.      (pc)))]
  520.   ""
  521.   "cmp%S0%B0%R0    %2,%1,%l3"
  522.   [(set_attr "type" "branch")])
  523.  
  524. (define_insn ""
  525.   [(set (pc)
  526.     (if_then_else
  527.      (match_operator 0 "comparison_operator"
  528.              [(match_operand:SI 1 "arith_operand" "d")
  529.               (match_operand:SI 2 "arith_operand" "dI")])
  530.      (pc)
  531.      (label_ref (match_operand 3 "" ""))))]
  532.   ""
  533.   "cmp%S0%B0%X0    %2,%1,%l3"
  534.   [(set_attr "type" "branch")])
  535.  
  536. ;; Normal move instructions.
  537. ;; This code is based on the sparc machine description.
  538.  
  539. (define_expand "movsi"
  540.   [(set (match_operand:SI 0 "general_operand" "")
  541.     (match_operand:SI 1 "general_operand" ""))]
  542.   ""
  543.   "
  544. {
  545.   if (emit_move_sequence (operands, SImode))
  546.     DONE;
  547. }")
  548.  
  549. ;; The store case can not be separate, because reload may convert a register
  550. ;; to register move insn to a store (or load) insn without rerecognizing
  551. ;; the insn.
  552.  
  553. ;; The i960 does not have any store constant to memory instruction.  However,
  554. ;; the calling convention is defined so that the arg pointer when it is not
  555. ;; overwise being used is zero.  Thus, we can handle store zero to memory
  556. ;; by storing an unused arg pointer.  The arg pointer will be unused if
  557. ;; current_function_args_size is zero.  This value of this variable is not
  558. ;; valid until after all rtl generation is complete, including function
  559. ;; inlining (because a function that doesn't need an arg pointer may be
  560. ;; inlined into a function that does need an arg pointer), so we must also
  561. ;; check that rtx_equal_function_value_matters is zero.
  562.  
  563. (define_insn ""
  564.   [(set (match_operand:SI 0 "general_operand" "=d,d,d,m")
  565.     (match_operand:SI 1 "general_operand" "dI,i,m,dJ"))]
  566.   "(current_function_args_size == 0
  567.     && rtx_equal_function_value_matters == 0)
  568.    && (register_operand (operands[0], SImode)
  569.        || register_operand (operands[1], SImode)
  570.        || operands[1] == const0_rtx)"
  571.   "*
  572. {
  573.   switch (which_alternative)
  574.     {
  575.     case 0:
  576.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  577.     {
  578.       if (GET_CODE (operands[1]) == REG)
  579.         return \"lda    (%1),%0\";
  580.       else
  581.         return \"lda    %1,%0\";
  582.     }
  583.       return \"mov    %1,%0\";
  584.     case 1:
  585.       return i960_output_ldconst (operands[0], operands[1]);
  586.     case 2:
  587.       return \"ld    %1,%0\";
  588.     case 3:
  589.       if (operands[1] == const0_rtx)
  590.     return \"st    g14,%0\";
  591.       return \"st    %1,%0\";      
  592.     }
  593. }"
  594.   [(set_attr "type" "move,address,load,store")
  595.    (set_attr "length" "*,3,*,*")])
  596.  
  597. (define_insn ""
  598.   [(set (match_operand:SI 0 "general_operand" "=d,d,d,m")
  599.     (match_operand:SI 1 "general_operand" "dI,i,m,d"))]
  600.   "(current_function_args_size != 0
  601.     || rtx_equal_function_value_matters != 0)
  602.    && (register_operand (operands[0], SImode)
  603.        || register_operand (operands[1], SImode))"
  604.   "*
  605. {
  606.   switch (which_alternative)
  607.     {
  608.     case 0:
  609.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  610.     {
  611.       if (GET_CODE (operands[1]) == REG)
  612.         return \"lda    (%1),%0\";
  613.       else
  614.         return \"lda    %1,%0\";
  615.     }
  616.       return \"mov    %1,%0\";
  617.     case 1:
  618.       return i960_output_ldconst (operands[0], operands[1]);
  619.     case 2:
  620.       return \"ld    %1,%0\";
  621.     case 3:
  622.       return \"st    %1,%0\";      
  623.     }
  624. }"
  625.   [(set_attr "type" "move,address,load,store")
  626.    (set_attr "length" "*,3,*,*")])
  627.  
  628. (define_expand "movhi"
  629.   [(set (match_operand:HI 0 "general_operand" "")
  630.     (match_operand:HI 1 "general_operand" ""))]
  631.   ""
  632.   "
  633. {
  634.   if (emit_move_sequence (operands, HImode))
  635.     DONE;
  636. }")
  637.  
  638. ;; Special pattern for zero stores to memory for functions which don't use
  639. ;; the arg pointer.
  640.  
  641. ;; The store case can not be separate.  See above.
  642. (define_insn ""
  643.   [(set (match_operand:HI 0 "general_operand" "=d,d,d,m")
  644.     (match_operand:HI 1 "general_operand" "dI,i,m,dJ"))]
  645.   "(current_function_args_size == 0
  646.     && rtx_equal_function_value_matters == 0)
  647.    && (register_operand (operands[0], HImode)
  648.        || register_operand (operands[1], HImode)
  649.        || operands[1] == const0_rtx)"
  650.   "*
  651. {
  652.   switch (which_alternative)
  653.     {
  654.     case 0:
  655.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  656.     {
  657.       if (GET_CODE (operands[1]) == REG)
  658.         return \"lda    (%1),%0\";
  659.       else
  660.         return \"lda    %1,%0\";
  661.     }
  662.       return \"mov    %1,%0\";
  663.     case 1:
  664.       return i960_output_ldconst (operands[0], operands[1]);
  665.     case 2:
  666.       return \"ldos    %1,%0\";
  667.     case 3:
  668.       if (operands[1] == const0_rtx)
  669.     return \"stos    g14,%0\";
  670.       return \"stos    %1,%0\";
  671.     }
  672. }"
  673.   [(set_attr "type" "move,misc,load,store")
  674.    (set_attr "length" "*,3,*,*")])
  675.  
  676. ;; The store case can not be separate.  See above.
  677. (define_insn ""
  678.   [(set (match_operand:HI 0 "general_operand" "=d,d,d,m")
  679.     (match_operand:HI 1 "general_operand" "dI,i,m,d"))]
  680.   "(current_function_args_size != 0
  681.     || rtx_equal_function_value_matters != 0)
  682.    && (register_operand (operands[0], HImode)
  683.        || register_operand (operands[1], HImode))"
  684.   "*
  685. {
  686.   switch (which_alternative)
  687.     {
  688.     case 0:
  689.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  690.     {
  691.       if (GET_CODE (operands[1]) == REG)
  692.         return \"lda    (%1),%0\";
  693.       else
  694.         return \"lda    %1,%0\";
  695.     }
  696.       return \"mov    %1,%0\";
  697.     case 1:
  698.       return i960_output_ldconst (operands[0], operands[1]);
  699.     case 2:
  700.       return \"ldos    %1,%0\";
  701.     case 3:
  702.       return \"stos    %1,%0\";
  703.     }
  704. }"
  705.   [(set_attr "type" "move,misc,load,store")
  706.    (set_attr "length" "*,3,*,*")])
  707.  
  708. (define_expand "movqi"
  709.   [(set (match_operand:QI 0 "general_operand" "")
  710.     (match_operand:QI 1 "general_operand" ""))]
  711.   ""
  712.   "
  713. {
  714.   if (emit_move_sequence (operands, QImode))
  715.     DONE;
  716. }")
  717.  
  718. ;; The store case can not be separate.  See comment above.
  719. (define_insn ""
  720.   [(set (match_operand:QI 0 "general_operand" "=d,d,d,m")
  721.     (match_operand:QI 1 "general_operand" "dI,i,m,dJ"))]
  722.   "(current_function_args_size == 0
  723.     && rtx_equal_function_value_matters == 0)
  724.    && (register_operand (operands[0], QImode)
  725.        || register_operand (operands[1], QImode)
  726.        || operands[1] == const0_rtx)"
  727.   "*
  728. {
  729.   switch (which_alternative)
  730.     {
  731.     case 0:
  732.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  733.     {
  734.       if (GET_CODE (operands[1]) == REG)
  735.         return \"lda    (%1),%0\";
  736.       else
  737.         return \"lda    %1,%0\";
  738.     }
  739.       return \"mov    %1,%0\";
  740.     case 1:
  741.       return i960_output_ldconst (operands[0], operands[1]);
  742.     case 2:
  743.       return \"ldob    %1,%0\";
  744.     case 3:
  745.       if (operands[1] == const0_rtx)
  746.     return \"stob    g14,%0\";
  747.       return \"stob    %1,%0\";
  748.     }
  749. }"
  750.   [(set_attr "type" "move,misc,load,store")
  751.    (set_attr "length" "*,3,*,*")])
  752.  
  753. ;; The store case can not be separate.  See comment above.
  754. (define_insn ""
  755.   [(set (match_operand:QI 0 "general_operand" "=d,d,d,m")
  756.     (match_operand:QI 1 "general_operand" "dI,i,m,d"))]
  757.   "(current_function_args_size != 0
  758.     || rtx_equal_function_value_matters != 0)
  759.    && (register_operand (operands[0], QImode)
  760.        || register_operand (operands[1], QImode))"
  761.   "*
  762. {
  763.   switch (which_alternative)
  764.     {
  765.     case 0:
  766.       if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
  767.     {
  768.       if (GET_CODE (operands[1]) == REG)
  769.         return \"lda    (%1),%0\";
  770.       else
  771.         return \"lda    %1,%0\";
  772.     }
  773.       return \"mov    %1,%0\";
  774.     case 1:
  775.       return i960_output_ldconst (operands[0], operands[1]);
  776.     case 2:
  777.       return \"ldob    %1,%0\";
  778.     case 3:
  779.       return \"stob    %1,%0\";
  780.     }
  781. }"
  782.   [(set_attr "type" "move,misc,load,store")
  783.    (set_attr "length" "*,3,*,*")])
  784.  
  785. (define_expand "movdi"
  786.   [(set (match_operand:DI 0 "general_operand" "")
  787.     (match_operand:DI 1 "general_operand" ""))]
  788.   ""
  789.   "
  790. {
  791.   if (emit_move_sequence (operands, DImode))
  792.     DONE;
  793. }")
  794.  
  795. ;; The store case can not be separate.  See comment above.
  796. (define_insn ""
  797.   [(set (match_operand:DI 0 "general_operand" "=d,d,d,m,o")
  798.     (match_operand:DI 1 "general_operand" "dI,i,m,d,J"))]
  799.   "(current_function_args_size == 0
  800.     && rtx_equal_function_value_matters == 0)
  801.    && (register_operand (operands[0], DImode)
  802.        || register_operand (operands[1], DImode)
  803.        || operands[1] == const0_rtx)"
  804.   "*
  805. {
  806.   switch (which_alternative)
  807.     {
  808.     case 0:
  809.       return \"movl    %1,%0\";
  810.     case 1:
  811.       return i960_output_ldconst (operands[0], operands[1]);
  812.     case 2:
  813.       return \"ldl    %1,%0\";
  814.     case 3:
  815.       return \"stl    %1,%0\";
  816.     case 4:
  817.       operands[1] = adj_offsettable_operand (operands[0], 4);
  818.       return \"st    g14,%0\;st    g14,%1\";
  819.     }
  820. }"
  821.   [(set_attr "type" "move,load,load,store,store")])
  822.  
  823. ;; The store case can not be separate.  See comment above.
  824. (define_insn ""
  825.   [(set (match_operand:DI 0 "general_operand" "=d,d,d,m")
  826.     (match_operand:DI 1 "general_operand" "dI,i,m,d"))]
  827.   "(current_function_args_size != 0
  828.     || rtx_equal_function_value_matters != 0)
  829.    && (register_operand (operands[0], DImode)
  830.        || register_operand (operands[1], DImode))"
  831.   "*
  832. {
  833.   switch (which_alternative)
  834.     {
  835.     case 0:
  836.       return \"movl    %1,%0\";
  837.     case 1:
  838.       return i960_output_ldconst (operands[0], operands[1]);
  839.     case 2:
  840.       return \"ldl    %1,%0\";
  841.     case 3:
  842.       return \"stl    %1,%0\";
  843.     }
  844. }"
  845.   [(set_attr "type" "move,load,load,store")])
  846.  
  847. (define_expand "movti"
  848.   [(set (match_operand:TI 0 "general_operand" "")
  849.     (match_operand:TI 1 "general_operand" ""))]
  850.   ""
  851.   "
  852. {
  853.   if (emit_move_sequence (operands, TImode))
  854.     DONE;
  855. }")
  856.  
  857. ;; The store case can not be separate.  See comment above.
  858. (define_insn ""
  859.   [(set (match_operand:TI 0 "general_operand" "=d,d,d,m,o")
  860.     (match_operand:TI 1 "general_operand" "dI,i,m,d,J"))]
  861.   "(current_function_args_size == 0
  862.     && rtx_equal_function_value_matters == 0)
  863.    && (register_operand (operands[0], TImode)
  864.        || register_operand (operands[1], TImode)
  865.        || operands[1] == const0_rtx)"
  866.   "*
  867. {
  868.   switch (which_alternative)
  869.     {
  870.     case 0:
  871.       return \"movq    %1,%0\";
  872.     case 1:
  873.       return i960_output_ldconst (operands[0], operands[1]);
  874.     case 2:
  875.       return \"ldq    %1,%0\";
  876.     case 3:
  877.       return \"stq    %1,%0\";
  878.     case 4:
  879.       operands[1] = adj_offsettable_operand (operands[0], 4);
  880.       operands[2] = adj_offsettable_operand (operands[0], 8);
  881.       operands[3] = adj_offsettable_operand (operands[0], 12);
  882.       return \"st    g14,%0\;st    g14,%1\;st    g14,%2\;st    g14,%3\";
  883.     }
  884. }"
  885.   [(set_attr "type" "move,load,load,store,store")])
  886.  
  887. ;; The store case can not be separate.  See comment above.
  888. (define_insn ""
  889.   [(set (match_operand:TI 0 "general_operand" "=d,d,d,m")
  890.     (match_operand:TI 1 "general_operand" "dI,i,m,d"))]
  891.   "(current_function_args_size != 0
  892.     || rtx_equal_function_value_matters != 0)
  893.    && (register_operand (operands[0], TImode)
  894.        || register_operand (operands[1], TImode))"
  895.   "*
  896. {
  897.   switch (which_alternative)
  898.     {
  899.     case 0:
  900.       return \"movq    %1,%0\";
  901.     case 1:
  902.       return i960_output_ldconst (operands[0], operands[1]);
  903.     case 2:
  904.       return \"ldq    %1,%0\";
  905.     case 3:
  906.       return \"stq    %1,%0\";
  907.     }
  908. }"
  909.   [(set_attr "type" "move,load,load,store")])
  910.  
  911. (define_expand "store_multiple"
  912.   [(set (match_operand:SI 0 "" "")    ;;- dest
  913.     (match_operand:SI 1 "" ""))    ;;- src
  914.    (use (match_operand:SI 2 "" ""))]    ;;- nregs
  915.   ""
  916.   "
  917. {
  918.   int regno;
  919.   int count;
  920.   rtx from;
  921.   int i;
  922.  
  923.   if (GET_CODE (operands[0]) != MEM
  924.       || GET_CODE (operands[1]) != REG
  925.       || GET_CODE (operands[2]) != CONST_INT)
  926.     FAIL;
  927.  
  928.   count = INTVAL (operands[2]);
  929.   if (count > 12)
  930.     FAIL;
  931.  
  932.   regno = REGNO (operands[1]);
  933.   from = memory_address (SImode, XEXP (operands[0], 0));
  934.   while (count >= 4 && ((regno & 3) == 0))
  935.     {
  936.       emit_insn (gen_rtx (SET, VOIDmode,
  937.               gen_rtx (MEM, TImode, from),
  938.               gen_rtx (REG, TImode, regno)));
  939.       count -= 4;
  940.       regno += 4;
  941.       from = memory_address (TImode, plus_constant (from, 16));
  942.     }
  943.   while (count >= 2 && ((regno & 1) == 0))
  944.     {
  945.       emit_insn (gen_rtx (SET, VOIDmode,
  946.               gen_rtx (MEM, DImode, from),
  947.               gen_rtx (REG, DImode, regno)));
  948.       count -= 2;
  949.       regno += 2;
  950.       from = memory_address (DImode, plus_constant (from, 8));
  951.     }
  952.   while (count > 0)
  953.     {
  954.       emit_insn (gen_rtx (SET, VOIDmode,
  955.               gen_rtx (MEM, SImode, from),
  956.               gen_rtx (REG, SImode, regno)));
  957.       count -= 1;
  958.       regno += 1;
  959.       from = memory_address (SImode, plus_constant (from, 4));
  960.     }
  961.   DONE;
  962. }")
  963.  
  964. ;; Floating point move insns
  965.  
  966. (define_expand "movdf"
  967.   [(set (match_operand:DF 0 "general_operand" "")
  968.     (match_operand:DF 1 "fpmove_src_operand" ""))]
  969.   ""
  970.   "
  971. {
  972.   if (emit_move_sequence (operands, DFmode))
  973.     DONE;
  974. }")
  975.  
  976. (define_insn ""
  977.   [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m,o")
  978.     (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d,G"))]
  979.   "(current_function_args_size == 0
  980.     && rtx_equal_function_value_matters == 0)
  981.    && (register_operand (operands[0], DFmode)
  982.        || register_operand (operands[1], DFmode)
  983.        || operands[1] == CONST0_RTX (DFmode))"
  984.   "*
  985. {
  986.   switch (which_alternative)
  987.     {
  988.     case 0:
  989.       if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  990.     return \"movrl    %1,%0\";
  991.       else
  992.     return \"movl    %1,%0\";
  993.     case 1:
  994.       return \"movrl    %1,%0\";
  995.     case 2:
  996.       return i960_output_ldconst (operands[0], operands[1]);
  997.     case 3:
  998.       return \"ldl    %1,%0\";
  999.     case 4:
  1000.       return \"stl    %1,%0\";
  1001.     case 5:
  1002.       operands[1] = adj_offsettable_operand (operands[0], 4);
  1003.       return \"st    g14,%0\;st    g14,%1\";
  1004.     }
  1005. }"
  1006.   [(set_attr "type" "move,move,load,fpload,fpstore,fpstore")])
  1007.  
  1008. (define_insn ""
  1009.   [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m")
  1010.     (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
  1011.   "(current_function_args_size != 0
  1012.     || rtx_equal_function_value_matters != 0)
  1013.    && (register_operand (operands[0], DFmode)
  1014.        || register_operand (operands[1], DFmode))"
  1015.   "*
  1016. {
  1017.   switch (which_alternative)
  1018.     {
  1019.     case 0:
  1020.       if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  1021.     return \"movrl    %1,%0\";
  1022.       else
  1023.     return \"movl    %1,%0\";
  1024.     case 1:
  1025.       return \"movrl    %1,%0\";
  1026.     case 2:
  1027.       return i960_output_ldconst (operands[0], operands[1]);
  1028.     case 3:
  1029.       return \"ldl    %1,%0\";
  1030.     case 4:
  1031.       return \"stl    %1,%0\";
  1032.     }
  1033. }"
  1034.   [(set_attr "type" "move,move,load,fpload,fpstore")])
  1035.  
  1036. (define_expand "movsf"
  1037.   [(set (match_operand:SF 0 "general_operand" "")
  1038.     (match_operand:SF 1 "fpmove_src_operand" ""))]
  1039.   ""
  1040.   "
  1041. {
  1042.   if (emit_move_sequence (operands, SFmode))
  1043.     DONE;
  1044. }")
  1045.  
  1046. (define_insn ""
  1047.   [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m")
  1048.     (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,dG"))]
  1049.   "(current_function_args_size == 0
  1050.     && rtx_equal_function_value_matters == 0)
  1051.    && (register_operand (operands[0], SFmode)
  1052.        || register_operand (operands[1], SFmode)
  1053.        || operands[1] == CONST0_RTX (SFmode))"
  1054.   "*
  1055. {
  1056.   switch (which_alternative)
  1057.     {
  1058.     case 0:
  1059.       if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  1060.     return \"movr    %1,%0\";
  1061.       else
  1062.     return \"mov    %1,%0\";
  1063.     case 1:
  1064.       return \"movr    %1,%0\";
  1065.     case 2:
  1066.       return i960_output_ldconst (operands[0], operands[1]);
  1067.     case 3:
  1068.       return \"ld    %1,%0\";
  1069.     case 4:
  1070.       if (operands[1] == CONST0_RTX (SFmode))
  1071.     return \"st    g14,%0\";
  1072.       return \"st    %1,%0\";
  1073.     }
  1074. }"
  1075.   [(set_attr "type" "move,move,load,fpload,fpstore")])
  1076.  
  1077. (define_insn ""
  1078.   [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m")
  1079.     (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
  1080.   "(current_function_args_size != 0
  1081.     || rtx_equal_function_value_matters != 0)
  1082.    && (register_operand (operands[0], SFmode)
  1083.        || register_operand (operands[1], SFmode))"
  1084.   "*
  1085. {
  1086.   switch (which_alternative)
  1087.     {
  1088.     case 0:
  1089.       if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  1090.     return \"movr    %1,%0\";
  1091.       else
  1092.     return \"mov    %1,%0\";
  1093.     case 1:
  1094.       return \"movr    %1,%0\";
  1095.     case 2:
  1096.       return i960_output_ldconst (operands[0], operands[1]);
  1097.     case 3:
  1098.       return \"ld    %1,%0\";
  1099.     case 4:
  1100.       return \"st    %1,%0\";
  1101.     }
  1102. }"
  1103.   [(set_attr "type" "move,move,load,fpload,fpstore")])
  1104.  
  1105. ;; Mixed-mode moves with sign and zero-extension.
  1106.  
  1107. ;; Note that the one starting from HImode comes before those for QImode
  1108. ;; so that a constant operand will match HImode, not QImode.
  1109.  
  1110. (define_expand "extendhisi2"
  1111.   [(set (match_operand:SI 0 "register_operand" "")
  1112.     (sign_extend:SI
  1113.      (match_operand:HI 1 "nonimmediate_operand" "")))]
  1114.  ""
  1115.  "
  1116. {
  1117.   if (GET_CODE (operand1) == REG
  1118.       || (GET_CODE (operand1) == SUBREG
  1119.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1120.     {
  1121.       rtx temp = gen_reg_rtx (SImode);
  1122.       rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
  1123.       int op1_subreg_word = 0;
  1124.  
  1125.       if (GET_CODE (operand1) == SUBREG)
  1126.     {
  1127.       op1_subreg_word = SUBREG_WORD (operand1);
  1128.       operand1 = SUBREG_REG (operand1);
  1129.     }
  1130.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
  1131.  
  1132.       emit_insn (gen_ashlsi3 (temp, operand1, shift_16));
  1133.       emit_insn (gen_ashrsi3 (operand0, temp, shift_16));
  1134.       DONE;
  1135.     }
  1136. }")
  1137.  
  1138. (define_insn ""
  1139.   [(set (match_operand:SI 0 "register_operand" "=d")
  1140.     (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
  1141.   ""
  1142.   "ldis    %1,%0"
  1143.   [(set_attr "type" "load")])
  1144.  
  1145. (define_expand "extendqisi2"
  1146.   [(set (match_operand:SI 0 "register_operand" "")
  1147.     (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
  1148.   ""
  1149.   "
  1150. {
  1151.   if (GET_CODE (operand1) == REG
  1152.       || (GET_CODE (operand1) == SUBREG
  1153.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1154.     {
  1155.       rtx temp = gen_reg_rtx (SImode);
  1156.       rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
  1157.       int op1_subreg_word = 0;
  1158.  
  1159.       if (GET_CODE (operand1) == SUBREG)
  1160.     {
  1161.       op1_subreg_word = SUBREG_WORD (operand1);
  1162.       operand1 = SUBREG_REG (operand1);
  1163.     }
  1164.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word),
  1165.  
  1166.       emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
  1167.       emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
  1168.       DONE;
  1169.     }
  1170. }")
  1171.  
  1172. (define_insn ""
  1173.   [(set (match_operand:SI 0 "register_operand" "=d")
  1174.     (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
  1175.   ""
  1176.   "ldib    %1,%0"
  1177.   [(set_attr "type" "load")])
  1178.  
  1179. (define_expand "extendqihi2"
  1180.   [(set (match_operand:HI 0 "register_operand" "")
  1181.     (sign_extend:HI
  1182.      (match_operand:QI 1 "nonimmediate_operand" "")))]
  1183.   ""
  1184.   "
  1185. {
  1186.   if (GET_CODE (operand1) == REG
  1187.       || (GET_CODE (operand1) == SUBREG
  1188.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1189.     {
  1190.       rtx temp = gen_reg_rtx (SImode);
  1191.       rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
  1192.       int op0_subreg_word = 0;
  1193.       int op1_subreg_word = 0;
  1194.  
  1195.       if (GET_CODE (operand1) == SUBREG)
  1196.     {
  1197.       op1_subreg_word = SUBREG_WORD (operand1);
  1198.       operand1 = SUBREG_REG (operand1);
  1199.     }
  1200.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
  1201.  
  1202.       if (GET_CODE (operand0) == SUBREG)
  1203.     {
  1204.       op0_subreg_word = SUBREG_WORD (operand0);
  1205.       operand0 = SUBREG_REG (operand0);
  1206.     }
  1207.       if (GET_MODE (operand0) != SImode)
  1208.     operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subreg_word);
  1209.  
  1210.       emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
  1211.       emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
  1212.       DONE;
  1213.     }
  1214. }")
  1215.  
  1216. (define_insn ""
  1217.   [(set (match_operand:HI 0 "register_operand" "=d")
  1218.     (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
  1219.   ""
  1220.   "ldib    %1,%0"
  1221.   [(set_attr "type" "load")])
  1222.  
  1223. (define_expand "zero_extendhisi2"
  1224.   [(set (match_operand:SI 0 "register_operand" "")
  1225.     (zero_extend:SI
  1226.      (match_operand:HI 1 "nonimmediate_operand" "")))]
  1227.  ""
  1228.  "
  1229. {
  1230.   if (GET_CODE (operand1) == REG
  1231.       || (GET_CODE (operand1) == SUBREG
  1232.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1233.     {
  1234.       rtx temp = gen_reg_rtx (SImode);
  1235.       rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
  1236.       int op1_subreg_word = 0;
  1237.  
  1238.       if (GET_CODE (operand1) == SUBREG)
  1239.     {
  1240.       op1_subreg_word = SUBREG_WORD (operand1);
  1241.       operand1 = SUBREG_REG (operand1);
  1242.     }
  1243.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
  1244.  
  1245.       emit_insn (gen_ashlsi3 (temp, operand1, shift_16));
  1246.       emit_insn (gen_lshrsi3 (operand0, temp, shift_16));
  1247.       DONE;
  1248.     }
  1249. }")
  1250.  
  1251. (define_insn ""
  1252.   [(set (match_operand:SI 0 "register_operand" "=d")
  1253.     (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
  1254.   ""
  1255.   "ldos    %1,%0"
  1256.   [(set_attr "type" "load")])
  1257.  
  1258. ;; Using shifts here generates much better code than doing an `and 255'.
  1259. ;; This is mainly because the `and' requires loading the constant separately,
  1260. ;; the constant is likely to get optimized, and then the compiler can't
  1261. ;; optimize the `and' because it doesn't know that one operand is a constant.
  1262.  
  1263. (define_expand "zero_extendqisi2"
  1264.   [(set (match_operand:SI 0 "register_operand" "")
  1265.     (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
  1266.   ""
  1267.   "
  1268. {
  1269.   if (GET_CODE (operand1) == REG
  1270.       || (GET_CODE (operand1) == SUBREG
  1271.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1272.     {
  1273.       rtx temp = gen_reg_rtx (SImode);
  1274.       rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
  1275.       int op1_subreg_word = 0;
  1276.  
  1277.       if (GET_CODE (operand1) == SUBREG)
  1278.     {
  1279.       op1_subreg_word = SUBREG_WORD (operand1);
  1280.       operand1 = SUBREG_REG (operand1);
  1281.     }
  1282.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
  1283.  
  1284.       emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
  1285.       emit_insn (gen_lshrsi3 (operand0, temp, shift_24));
  1286.       DONE;
  1287.     }
  1288. }")
  1289.  
  1290. (define_insn ""
  1291.   [(set (match_operand:SI 0 "register_operand" "=d")
  1292.     (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
  1293.   ""
  1294.   "ldob    %1,%0"
  1295.   [(set_attr "type" "load")])
  1296.  
  1297. (define_expand "zero_extendqihi2"
  1298.   [(set (match_operand:HI 0 "register_operand" "")
  1299.     (zero_extend:HI
  1300.      (match_operand:QI 1 "nonimmediate_operand" "")))]
  1301.   ""
  1302.   "
  1303. {
  1304.   if (GET_CODE (operand1) == REG
  1305.       || (GET_CODE (operand1) == SUBREG
  1306.       && GET_CODE (XEXP (operand1, 0)) == REG))
  1307.     {
  1308.       rtx temp = gen_reg_rtx (SImode);
  1309.       rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
  1310.       int op0_subreg_word = 0;
  1311.       int op1_subreg_word = 0;
  1312.  
  1313.       if (GET_CODE (operand1) == SUBREG)
  1314.     {
  1315.       op1_subreg_word = SUBREG_WORD (operand1);
  1316.       operand1 = SUBREG_REG (operand1);
  1317.     }
  1318.       operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
  1319.  
  1320.       if (GET_CODE (operand0) == SUBREG)
  1321.     {
  1322.       op0_subreg_word = SUBREG_WORD (operand0);
  1323.       operand0 = SUBREG_REG (operand0);
  1324.     }
  1325.       if (GET_MODE (operand0) != SImode)
  1326.     operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subreg_word);
  1327.  
  1328.       emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
  1329.       emit_insn (gen_lshrsi3 (operand0, temp, shift_24));
  1330.       DONE;
  1331.     }
  1332. }")
  1333.  
  1334. (define_insn ""
  1335.   [(set (match_operand:HI 0 "register_operand" "=d")
  1336.     (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
  1337.   ""
  1338.   "ldob    %1,%0"
  1339.   [(set_attr "type" "load")])
  1340.  
  1341. ;; Conversions between float and double.
  1342.  
  1343. (define_insn "extendsfdf2"
  1344.   [(set (match_operand:DF 0 "register_operand" "=*f,d")
  1345.     (float_extend:DF (match_operand:SF 1 "fp_arith_operand" "dGH,fGH")))]
  1346.   "TARGET_NUMERICS"
  1347.   "@
  1348.   movr    %1,%0
  1349.   movrl    %1,%0"
  1350.   [(set_attr "type" "fpmove")])
  1351.  
  1352. (define_insn "truncdfsf2"
  1353.   [(set (match_operand:SF 0 "register_operand" "=d")
  1354.     (float_truncate:SF
  1355.      (match_operand:DF 1 "fp_arith_operand" "fGH")))]
  1356.   "TARGET_NUMERICS"
  1357.   "movr    %1,%0"
  1358.   [(set_attr "type" "fpmove")])
  1359.  
  1360. ;; Conversion between fixed point and floating point.
  1361.  
  1362. (define_insn "floatsidf2"
  1363.   [(set (match_operand:DF 0 "register_operand" "=f")
  1364.     (float:DF (match_operand:SI 1 "register_operand" "d")))]
  1365.   "TARGET_NUMERICS"
  1366.   "cvtir    %1,%0"
  1367.   [(set_attr "type" "fpcvt")])
  1368.  
  1369. (define_insn "floatsisf2"
  1370.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1371.     (float:SF (match_operand:SI 1 "register_operand" "d")))]
  1372.   "TARGET_NUMERICS"
  1373.   "cvtir    %1,%0"
  1374.   [(set_attr "type" "fpcvt")])
  1375.  
  1376. ;; Convert a float to an actual integer.
  1377. ;; Truncation is performed as part of the conversion.
  1378. ;; The i960 requires conversion from DFmode to DImode to make
  1379. ;; unsigned conversions work properly.
  1380.  
  1381. (define_insn "fixuns_truncdfdi2"
  1382.   [(set (match_operand:DI 0 "register_operand" "=d")
  1383.     (unsigned_fix:DI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))]
  1384.   "TARGET_NUMERICS"
  1385.   "cvtzril    %1,%0"
  1386.   [(set_attr "type" "fpcvt")])
  1387.  
  1388. (define_insn "fixuns_truncsfdi2"
  1389.   [(set (match_operand:DI 0 "register_operand" "=d")
  1390.     (unsigned_fix:DI (fix:SF (match_operand:SF 1 "fp_arith_operand" "fGH"))))]
  1391.   "TARGET_NUMERICS"
  1392.   "cvtzril    %1,%0"
  1393.   [(set_attr "type" "fpcvt")])
  1394.  
  1395. (define_insn "fix_truncdfsi2"
  1396.   [(set (match_operand:SI 0 "register_operand" "=d")
  1397.     (fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))]
  1398.   "TARGET_NUMERICS"
  1399.   "cvtzri    %1,%0"
  1400.   [(set_attr "type" "fpcvt")])
  1401.  
  1402. (define_expand "fixuns_truncdfsi2"
  1403.   [(set (match_operand:SI 0 "register_operand" "")
  1404.     (unsigned_fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" ""))))]
  1405.   "TARGET_NUMERICS"
  1406.   "
  1407. {
  1408.   rtx temp = gen_reg_rtx (DImode);
  1409.   emit_insn (gen_rtx (SET, VOIDmode, temp,
  1410.               gen_rtx (UNSIGNED_FIX, DImode,
  1411.                    gen_rtx (FIX, DFmode, operands[1]))));
  1412.   emit_insn (gen_rtx (SET, VOIDmode, operands[0],
  1413.               gen_rtx (SUBREG, SImode, temp, 0)));
  1414.   DONE;
  1415. }")
  1416.  
  1417. (define_insn "fix_truncsfsi2"
  1418.   [(set (match_operand:SI 0 "register_operand" "=d")
  1419.     (fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" "dfGH"))))]
  1420.   "TARGET_NUMERICS"
  1421.   "cvtzri    %1,%0"
  1422.   [(set_attr "type" "fpcvt")])
  1423.  
  1424. (define_expand "fixuns_truncsfsi2"
  1425.   [(set (match_operand:SI 0 "register_operand" "")
  1426.     (unsigned_fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" ""))))]
  1427.   "TARGET_NUMERICS"
  1428.   "
  1429. {
  1430.   rtx temp = gen_reg_rtx (DImode);
  1431.   emit_insn (gen_rtx (SET, VOIDmode, temp,
  1432.               gen_rtx (UNSIGNED_FIX, DImode,
  1433.                    gen_rtx (FIX, SFmode, operands[1]))));
  1434.   emit_insn (gen_rtx (SET, VOIDmode, operands[0],
  1435.               gen_rtx (SUBREG, SImode, temp, 0)));
  1436.   DONE;
  1437. }")
  1438.  
  1439. ;; Arithmetic instructions.
  1440.  
  1441. (define_insn "subsi3"
  1442.   [(set (match_operand:SI 0 "register_operand" "=d")
  1443.     (minus:SI (match_operand:SI 1 "arith_operand" "dI")
  1444.           (match_operand:SI 2 "arith_operand" "dI")))]
  1445.   ""
  1446.   "subo    %2,%1,%0")
  1447.  
  1448. ;; Try to generate an lda instruction when it would be faster than an
  1449. ;; add instruction.
  1450. ;; Some assemblers apparently won't accept two addresses added together.
  1451.  
  1452. (define_insn ""
  1453.   [(set (match_operand:SI 0 "register_operand" "=d,d,d")
  1454.     (plus:SI (match_operand:SI 1 "arith32_operand" "%dn,i,dn")
  1455.          (match_operand:SI 2 "arith32_operand" "dn,dn,i")))]
  1456.   "(TARGET_C_SERIES) && (CONSTANT_P (operands[1]) || CONSTANT_P (operands[2]))"
  1457.   "*
  1458. {
  1459.   if (GET_CODE (operands[1]) == CONST_INT)
  1460.     {
  1461.       rtx tmp = operands[1];
  1462.       operands[1] = operands[2];
  1463.       operands[2] = tmp;
  1464.     }
  1465.   if (GET_CODE (operands[2]) == CONST_INT
  1466.       && GET_CODE (operands[1]) == REG
  1467.       && i960_last_insn_type != I_TYPE_REG)
  1468.     {
  1469.       if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) > -32)
  1470.     return \"subo    %n2,%1,%0\";
  1471.       else if (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32)
  1472.     return \"addo    %1,%2,%0\";
  1473.     }
  1474.   if (CONSTANT_P (operands[1]))
  1475.     return \"lda    %1+%2,%0\";
  1476.   return \"lda    %2(%1),%0\";
  1477. }")
  1478.  
  1479. (define_insn "addsi3"
  1480.   [(set (match_operand:SI 0 "register_operand" "=d")
  1481.     (plus:SI (match_operand:SI 1 "signed_arith_operand" "%dI")
  1482.          (match_operand:SI 2 "signed_arith_operand" "dIK")))]
  1483.   ""
  1484.   "*
  1485. {
  1486.   if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
  1487.     return \"subo    %n2,%1,%0\";
  1488.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1489.     return \"addo    %2,%1,%0\";
  1490.   return \"addo    %1,%2,%0\";
  1491. }")
  1492.  
  1493. (define_insn "mulsi3"
  1494.   [(set (match_operand:SI 0 "register_operand" "=d")
  1495.     (mult:SI (match_operand:SI 1 "arith_operand" "%dI")
  1496.          (match_operand:SI 2 "arith_operand" "dI")))]
  1497.   ""
  1498.   "*
  1499. {
  1500.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1501.     return \"mulo    %2,%1,%0\";
  1502.   return \"mulo    %1,%2,%0\";
  1503. }"
  1504.   [(set_attr "type" "mult")])
  1505.  
  1506. (define_insn "umulsidi3"
  1507.   [(set (match_operand:DI 0 "register_operand" "=d")
  1508.     (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
  1509.          (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
  1510.   ""
  1511.   "*
  1512. {
  1513.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1514.     return \"emul    %2,%1,%0\";
  1515.   return \"emul    %1,%2,%0\";
  1516. }"
  1517.   [(set_attr "type" "mult")])
  1518.  
  1519. (define_insn ""
  1520.   [(set (match_operand:DI 0 "register_operand" "=d")
  1521.     (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%d"))
  1522.          (match_operand:SI 2 "literal" "I")))]
  1523.   ""
  1524.   "*
  1525. {
  1526.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1527.     return \"emul    %2,%1,%0\";
  1528.   return \"emul    %1,%2,%0\";
  1529. }"
  1530.   [(set_attr "type" "mult")])
  1531.  
  1532. ;; This goes after the move/add/sub/mul instructions  
  1533. ;; because those instructions are better when they apply.
  1534.  
  1535. (define_insn ""
  1536.   [(set (match_operand:SI 0 "register_operand" "=d")
  1537.     (match_operand:SI 1 "address_operand" "p"))]
  1538.   ""
  1539.   "lda    %a1,%0"
  1540.   [(set_attr "type" "load")])
  1541.  
  1542. ;; This will never be selected because of an "optimization" that GCC does.
  1543. ;; It always converts divides by a power of 2 into a sequence of instructions
  1544. ;; that does a right shift, and then corrects the result if it was negative.
  1545.  
  1546. ;; (define_insn ""
  1547. ;;   [(set (match_operand:SI 0 "register_operand" "=d")
  1548. ;;         (div:SI (match_operand:SI 1 "arith_operand" "dI")
  1549. ;;                 (match_operand:SI 2 "power2_operand" "nI")))]
  1550. ;;   ""
  1551. ;;   "*{
  1552. ;;     operands[2] = gen_rtx(CONST_INT, VOIDmode,bitpos (INTVAL (operands[2])));
  1553. ;;     return \"shrdi    %2,%1,%0\";
  1554. ;;   }"
  1555.  
  1556. (define_insn "divsi3"
  1557.   [(set (match_operand:SI 0 "register_operand" "=d")
  1558.         (div:SI (match_operand:SI 1 "arith_operand" "dI")
  1559.                 (match_operand:SI 2 "arith_operand" "dI")))]
  1560.   ""
  1561.   "divi    %2,%1,%0"
  1562.   [(set_attr "type" "div")])
  1563.  
  1564. (define_insn "udivsi3"
  1565.   [(set (match_operand:SI 0 "register_operand" "=d")
  1566.         (udiv:SI (match_operand:SI 1 "arith_operand" "dI")
  1567.          (match_operand:SI 2 "arith_operand" "dI")))]
  1568.   ""
  1569.   "divo    %2,%1,%0"
  1570.   [(set_attr "type" "div")])
  1571.  
  1572. ;; We must use `remi' not `modi' here, to ensure that `%' has the effects
  1573. ;; specified by the ANSI C standard.
  1574.  
  1575. (define_insn "modsi3"
  1576.   [(set (match_operand:SI 0 "register_operand" "=d")
  1577.         (mod:SI (match_operand:SI 1 "arith_operand" "dI")
  1578.                 (match_operand:SI 2 "arith_operand" "dI")))]
  1579.   ""
  1580.   "remi    %2,%1,%0"
  1581.   [(set_attr "type" "div")])
  1582.  
  1583. (define_insn "umodsi3"
  1584.   [(set (match_operand:SI 0 "register_operand" "=d")
  1585.         (umod:SI (match_operand:SI 1 "arith_operand" "dI")
  1586.          (match_operand:SI 2 "arith_operand" "dI")))]
  1587.   ""
  1588.   "remo    %2,%1,%0"
  1589.   [(set_attr "type" "div")])
  1590.  
  1591. ;; And instructions (with complement also).
  1592.  
  1593. (define_insn "andsi3"
  1594.   [(set (match_operand:SI 0 "register_operand" "=d")
  1595.     (and:SI (match_operand:SI 1 "arith_operand" "%dI")
  1596.         (match_operand:SI 2 "arith_operand" "dI")))]
  1597.   ""
  1598.   "*
  1599. {
  1600.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1601.     return \"and    %2,%1,%0\";
  1602.   return \"and    %1,%2,%0\";
  1603. }")
  1604.  
  1605. (define_insn ""
  1606.   [(set (match_operand:SI 0 "register_operand" "=d")
  1607.     (and:SI (not:SI (match_operand:SI 1 "arith_operand" "dI"))
  1608.         (match_operand:SI 2 "arith_operand" "dI")))]
  1609.   ""
  1610.   "*
  1611. {
  1612.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1613.     return \"notand    %2,%1,%0\";
  1614.   return \"andnot    %1,%2,%0\";
  1615. }")
  1616.  
  1617. (define_insn ""
  1618.   [(set (match_operand:SI 0 "register_operand" "=d")
  1619.     (ior:SI (not:SI (match_operand:SI 1 "arith_operand" "%dI"))
  1620.         (not:SI (match_operand:SI 2 "arith_operand" "dI"))))]
  1621.   ""
  1622.   "*
  1623. {
  1624.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1625.     return \"nand    %2,%1,%0\";
  1626.   return \"nand    %1,%2,%0\";
  1627. }")
  1628.  
  1629. (define_insn ""
  1630.   [(set (match_operand:SI 0 "register_operand" "=d")
  1631.     (ior:SI (match_operand:SI 1 "arith_operand" "dI")
  1632.         (match_operand:SI 2 "power2_operand" "n")))]
  1633.   ""
  1634.   "*
  1635. {
  1636.   operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1637.              bitpos (INTVAL (operands[2])));
  1638.   return \"setbit    %2,%1,%0\";
  1639. }")
  1640.  
  1641. (define_insn ""
  1642.   [(set (match_operand:SI 0 "register_operand" "=d")
  1643.     (ior:SI (ashift:SI (const_int 1)
  1644.                (match_operand:SI 1 "register_operand" "d"))
  1645.         (match_operand:SI 2 "arith_operand" "dI")))]
  1646.   ""
  1647.   "setbit    %1,%2,%0")
  1648.  
  1649. (define_insn ""
  1650.   [(set (match_operand:SI 0 "register_operand" "=d")
  1651.     (and:SI (match_operand:SI 1 "arith_operand" "dI")
  1652.         (match_operand:SI 2 "cmplpower2_operand" "n")))]
  1653.   ""
  1654.   "*
  1655. {
  1656.   operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1657.              bitpos (~INTVAL (operands[2])));
  1658.   return \"clrbit    %2,%1,%0\";
  1659. }")
  1660.  
  1661. ;; (not (ashift 1 reg)) canonicalizes to (rotate -2 reg)
  1662. (define_insn ""
  1663.   [(set (match_operand:SI 0 "register_operand" "=d")
  1664.     (and:SI (rotate:SI (const_int -2)
  1665.                (match_operand:SI 1 "register_operand" "d"))
  1666.         (match_operand:SI 2 "register_operand" "d")))]
  1667.   ""
  1668.   "clrbit    %1,%2,%0")
  1669.  
  1670. ;; The above pattern canonicalizes to this when both the input and output
  1671. ;; are the same pseudo-register.
  1672. (define_insn ""
  1673.   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "=d")
  1674.              (const_int 1)
  1675.              (match_operand:SI 1 "register_operand" "d"))
  1676.     (const_int 0))]
  1677.   ""
  1678.   "clrbit    %1,%0,%0")
  1679.  
  1680. (define_insn ""
  1681.   [(set (match_operand:SI 0 "register_operand" "=d")
  1682.     (xor:SI (match_operand:SI 1 "arith_operand" "dI")
  1683.         (match_operand:SI 2 "power2_operand" "n")))]
  1684.   ""
  1685.   "*
  1686. {
  1687.   operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1688.              bitpos (INTVAL (operands[2])));
  1689.   return \"notbit    %2,%1,%0\";
  1690. }")
  1691.  
  1692. (define_insn ""
  1693.   [(set (match_operand:SI 0 "register_operand" "=d")
  1694.     (xor:SI (ashift:SI (const_int 1)
  1695.                (match_operand:SI 1 "register_operand" "d"))
  1696.         (match_operand:SI 2 "arith_operand" "dI")))]
  1697.   ""
  1698.   "notbit    %1,%2,%0")
  1699.  
  1700. (define_insn "iorsi3"
  1701.   [(set (match_operand:SI 0 "register_operand" "=d")
  1702.     (ior:SI (match_operand:SI 1 "arith_operand" "%dI")
  1703.         (match_operand:SI 2 "arith_operand" "dI")))]
  1704.   ""
  1705.   "*
  1706. {
  1707.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1708.     return \"or    %2,%1,%0\";
  1709.   return \"or    %1,%2,%0\";
  1710. }")
  1711.  
  1712. (define_insn ""
  1713.   [(set (match_operand:SI 0 "register_operand" "=d")
  1714.     (ior:SI (not:SI (match_operand:SI 1 "arith_operand" "dI"))
  1715.         (match_operand:SI 2 "arith_operand" "dI")))]
  1716.   ""
  1717.   "*
  1718. {
  1719.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1720.     return \"notor    %2,%1,%0\";
  1721.   return \"ornot    %1,%2,%0\";
  1722. }")
  1723.  
  1724. (define_insn ""
  1725.   [(set (match_operand:SI 0 "register_operand" "=d")
  1726.     (and:SI (not:SI (match_operand:SI 1 "arith_operand" "%dI"))
  1727.         (not:SI (match_operand:SI 2 "arith_operand" "dI"))))]
  1728.   ""
  1729.   "*
  1730. {
  1731.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1732.     return \"nor    %2,%1,%0\";
  1733.   return \"nor    %1,%2,%0\";
  1734. }")
  1735.  
  1736. (define_insn "xorsi3"
  1737.   [(set (match_operand:SI 0 "register_operand" "=d")
  1738.     (xor:SI (match_operand:SI 1 "arith_operand" "%dI")
  1739.         (match_operand:SI 2 "arith_operand" "dI")))]
  1740.   ""
  1741.   "*
  1742. {
  1743.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1744.     return \"xor    %2,%1,%0\";
  1745.   return \"xor    %1,%2,%0\";
  1746. }")
  1747.  
  1748. (define_insn ""
  1749.   [(set (match_operand:SI 0 "register_operand" "=d")
  1750.     (not:SI (xor:SI (match_operand:SI 1 "arith_operand" "%dI")
  1751.             (match_operand:SI 2 "arith_operand" "dI"))))]
  1752.   ""
  1753.   "*
  1754. {
  1755.   if (i960_bypass (insn, operands[1], operands[2], 0))
  1756.     return \"xnor    %2,%1,%0\";
  1757.   return \"xnor    %2,%1,%0\";
  1758. }")
  1759.  
  1760. (define_insn "negsi2"
  1761.   [(set (match_operand:SI 0 "register_operand" "=d")
  1762.     (neg:SI (match_operand:SI 1 "arith_operand" "dI")))]
  1763.   ""
  1764.   "subo    %1,0,%0"
  1765.   [(set_attr "length" "1")])
  1766.  
  1767. (define_insn "one_cmplsi2"
  1768.   [(set (match_operand:SI 0 "register_operand" "=d")
  1769.     (not:SI (match_operand:SI 1 "arith_operand" "dI")))]
  1770.   ""
  1771.   "not    %1,%0"
  1772.   [(set_attr "length" "1")])
  1773.  
  1774. ;; Floating point arithmetic instructions.
  1775.  
  1776. (define_insn "adddf3"
  1777.   [(set (match_operand:DF 0 "register_operand" "=d*f")
  1778.     (plus:DF (match_operand:DF 1 "fp_arith_operand" "%rGH")
  1779.          (match_operand:DF 2 "fp_arith_operand" "rGH")))]
  1780.   "TARGET_NUMERICS"
  1781.   "addrl    %1,%2,%0"
  1782.   [(set_attr "type" "fpadd")])
  1783.  
  1784. (define_insn "addsf3"
  1785.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1786.     (plus:SF (match_operand:SF 1 "fp_arith_operand" "%rGH")
  1787.          (match_operand:SF 2 "fp_arith_operand" "rGH")))]
  1788.   "TARGET_NUMERICS"
  1789.   "addr    %1,%2,%0"
  1790.   [(set_attr "type" "fpadd")])
  1791.  
  1792.  
  1793. (define_insn "subdf3"
  1794.   [(set (match_operand:DF 0 "register_operand" "=d*f")
  1795.     (minus:DF (match_operand:DF 1 "fp_arith_operand" "rGH")
  1796.           (match_operand:DF 2 "fp_arith_operand" "rGH")))]
  1797.   "TARGET_NUMERICS"
  1798.   "subrl    %2,%1,%0"
  1799.   [(set_attr "type" "fpadd")])
  1800.  
  1801. (define_insn "subsf3"
  1802.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1803.     (minus:SF (match_operand:SF 1 "fp_arith_operand" "rGH")
  1804.           (match_operand:SF 2 "fp_arith_operand" "rGH")))]
  1805.   "TARGET_NUMERICS"
  1806.   "subr    %2,%1,%0"
  1807.   [(set_attr "type" "fpadd")])
  1808.  
  1809.  
  1810. (define_insn "muldf3"
  1811.   [(set (match_operand:DF 0 "register_operand" "=d*f")
  1812.     (mult:DF (match_operand:DF 1 "fp_arith_operand" "%rGH")
  1813.          (match_operand:DF 2 "fp_arith_operand" "rGH")))]
  1814.   "TARGET_NUMERICS"
  1815.   "mulrl    %1,%2,%0"
  1816.   [(set_attr "type" "fpmul")])
  1817.  
  1818. (define_insn "mulsf3"
  1819.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1820.     (mult:SF (match_operand:SF 1 "fp_arith_operand" "%rGH")
  1821.          (match_operand:SF 2 "fp_arith_operand" "rGH")))]
  1822.   "TARGET_NUMERICS"
  1823.   "mulr    %1,%2,%0"
  1824.   [(set_attr "type" "fpmul")])
  1825.  
  1826.  
  1827. (define_insn "divdf3"
  1828.   [(set (match_operand:DF 0 "register_operand" "=d*f")
  1829.     (div:DF (match_operand:DF 1 "fp_arith_operand" "rGH")
  1830.         (match_operand:DF 2 "fp_arith_operand" "rGH")))]
  1831.   "TARGET_NUMERICS"
  1832.   "divrl    %2,%1,%0"
  1833.   [(set_attr "type" "fpdiv")])
  1834.  
  1835. (define_insn "divsf3"
  1836.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1837.     (div:SF (match_operand:SF 1 "fp_arith_operand" "rGH")
  1838.         (match_operand:SF 2 "fp_arith_operand" "rGH")))]
  1839.   "TARGET_NUMERICS"
  1840.   "divr    %2,%1,%0"
  1841.   [(set_attr "type" "fpdiv")])
  1842.  
  1843. (define_insn "negdf2"
  1844.   [(set (match_operand:DF 0 "register_operand" "=d,d*f")
  1845.     (neg:DF (match_operand:DF 1 "register_operand" "d,r")))]
  1846.   ""
  1847.   "*
  1848. {
  1849.   if (which_alternative == 0)
  1850.     {
  1851.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1852.     return \"notbit    31,%D1,%D0\";
  1853.       return \"mov    %1,%0\;notbit    31,%D1,%D0\";
  1854.     }
  1855.   return \"subrl    %1,0f0.0,%0\";
  1856. }"
  1857.   [(set_attr "type" "fpadd")])
  1858.  
  1859. (define_insn "negsf2"
  1860.   [(set (match_operand:SF 0 "register_operand" "=d,d*f")
  1861.     (neg:SF (match_operand:SF 1 "register_operand" "d,r")))]
  1862.   ""
  1863.   "@
  1864.   notbit    31,%1,%0
  1865.   subr    %1,0f0.0,%0"
  1866.   [(set_attr "type" "fpadd")])
  1867.  
  1868. ;;; The abs patterns also work even if the target machine doesn't have
  1869. ;;; floating point, because in that case dstreg and srcreg will always be
  1870. ;;; less than 32.
  1871.  
  1872. (define_insn "absdf2"
  1873.   [(set (match_operand:DF 0 "register_operand" "=d*f")
  1874.     (abs:DF (match_operand:DF 1 "register_operand" "df")))]
  1875.   ""
  1876.   "*
  1877. {
  1878.   int dstreg = REGNO (operands[0]);
  1879.   int srcreg = REGNO (operands[1]);
  1880.  
  1881.   if (dstreg < 32)
  1882.     {
  1883.       if (srcreg < 32)
  1884.     {
  1885.       if (dstreg != srcreg)
  1886.         output_asm_insn (\"mov    %1,%0\", operands);
  1887.       return \"clrbit    31,%D1,%D0\";
  1888.     }
  1889.       /* Src is an fp reg.  */
  1890.       return \"movrl    %1,%0\;clrbit    31,%D1,%D0\";
  1891.     }
  1892.   if (srcreg >= 32)
  1893.     return \"cpysre    %1,0f0.0,%0\";
  1894.   return \"movrl    %1,%0\;cpysre    %0,0f0.0,%0\";
  1895. }"
  1896.   [(set_attr "type" "multi")])
  1897.  
  1898. (define_insn "abssf2"
  1899.   [(set (match_operand:SF 0 "register_operand" "=d*f")
  1900.     (abs:SF (match_operand:SF 1 "register_operand" "df")))]
  1901.   ""
  1902.   "*
  1903. {
  1904.   int dstreg = REGNO (operands[0]);
  1905.   int srcreg = REGNO (operands[1]);
  1906.  
  1907.   if (dstreg < 32 && srcreg < 32)
  1908.     return \"clrbit    31,%1,%0\";
  1909.  
  1910.   if (dstreg >= 32 && srcreg >= 32)
  1911.     return \"cpysre    %1,0f0.0,%0\";
  1912.  
  1913.   if (dstreg < 32)
  1914.     return \"movr    %1,%0\;clrbit    31,%0,%0\";
  1915.  
  1916.   return \"movr    %1,%0\;cpysre    %0,0f0.0,%0\";
  1917. }"
  1918.   [(set_attr "type" "multi")])
  1919.  
  1920. ;; Tetra (16 byte) float support.
  1921.  
  1922. (define_expand "cmpxf"
  1923.   [(set (reg:CC 36)
  1924.     (compare:CC (match_operand:XF 0 "register_operand" "")
  1925.             (match_operand:XF 1 "nonmemory_operand" "")))]
  1926.   "TARGET_NUMERICS"
  1927.   "
  1928. {
  1929.   i960_compare_op0 = operands[0];
  1930.   i960_compare_op1 = operands[1];
  1931.   DONE;
  1932. }")
  1933.  
  1934. (define_insn ""
  1935.   [(set (reg:CC 36)
  1936.     (compare:CC (match_operand:XF 0 "register_operand" "f")
  1937.             (match_operand:XF 1 "nonmemory_operand" "fGH")))]
  1938.   "TARGET_NUMERICS"
  1939.   "cmpr %0,%1"
  1940.   [(set_attr "type" "fpcc")])
  1941.  
  1942. (define_expand "movxf"
  1943.   [(set (match_operand:XF 0 "general_operand" "")
  1944.     (match_operand:XF 1 "fpmove_src_operand" ""))]
  1945.   ""
  1946.   "
  1947. {
  1948.   if (emit_move_sequence (operands, XFmode))
  1949.     DONE;
  1950. }")
  1951.  
  1952. (define_insn ""
  1953.   [(set (match_operand:XF 0 "general_operand" "=r,f,d,d,m")
  1954.     (match_operand:XF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
  1955.   "register_operand (operands[0], XFmode)
  1956.    || register_operand (operands[1], XFmode)"
  1957.   "*
  1958. {
  1959.   switch (which_alternative)
  1960.     {
  1961.     case 0:
  1962.       if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  1963.     return \"movre    %1,%0\";
  1964.       else
  1965.     return \"movq    %1,%0\";
  1966.     case 1:
  1967.       return \"movre    %1,%0\";
  1968.     case 2:
  1969.       return i960_output_ldconst (operands[0], operands[1]);
  1970.     case 3:
  1971.       return \"ldt    %1,%0\";
  1972.     case 4:
  1973.       return \"stt    %1,%0\";
  1974.     }
  1975. }"
  1976.   [(set_attr "type" "move,move,load,fpload,fpstore")])
  1977.  
  1978. (define_insn "extendsfxf2"
  1979.   [(set (match_operand:XF 0 "register_operand" "=f,d")
  1980.     (float_extend:XF
  1981.      (match_operand:SF 1 "register_operand" "d,f")))]
  1982.   "TARGET_NUMERICS"
  1983.   "@
  1984.   movr    %1,%0
  1985.   movre    %1,%0"
  1986.   [(set_attr "type" "fpmove")])
  1987.  
  1988. (define_insn "extenddfxf2"
  1989.   [(set (match_operand:XF 0 "register_operand" "=f,d")
  1990.     (float_extend:XF
  1991.      (match_operand:DF 1 "register_operand" "d,f")))]
  1992.   "TARGET_NUMERICS"
  1993.   "@
  1994.   movrl    %1,%0
  1995.   movre    %1,%0"
  1996.   [(set_attr "type" "fpmove")])
  1997.  
  1998. (define_insn "truncxfdf2"
  1999.   [(set (match_operand:DF 0 "register_operand" "=d")
  2000.     (float_truncate:DF
  2001.      (match_operand:XF 1 "register_operand" "f")))]
  2002.   "TARGET_NUMERICS"
  2003.   "movrl    %1,%0"
  2004.   [(set_attr "type" "fpmove")])
  2005.  
  2006. (define_insn "truncxfsf2"
  2007.   [(set (match_operand:SF 0 "register_operand" "=d")
  2008.     (float_truncate:SF
  2009.      (match_operand:XF 1 "register_operand" "f")))]
  2010.   "TARGET_NUMERICS"
  2011.   "movr    %1,%0"
  2012.   [(set_attr "type" "fpmove")])
  2013.  
  2014. (define_insn "floatsixf2"
  2015.   [(set (match_operand:XF 0 "register_operand" "=f")
  2016.     (float:XF (match_operand:SI 1 "register_operand" "d")))]
  2017.   "TARGET_NUMERICS"
  2018.   "cvtir    %1,%0"
  2019.   [(set_attr "type" "fpcvt")])
  2020.  
  2021. (define_insn "fix_truncxfsi2"
  2022.   [(set (match_operand:SI 0 "register_operand" "=d")
  2023.     (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))]
  2024.   "TARGET_NUMERICS"
  2025.   "cvtzri    %1,%0"
  2026.   [(set_attr "type" "fpcvt")])
  2027.  
  2028. (define_insn "fixuns_truncxfsi2"
  2029.   [(set (match_operand:SI 0 "register_operand" "=d")
  2030.     (unsigned_fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))]
  2031.   "TARGET_NUMERICS"
  2032.   "cvtzri    %1,%0"
  2033.   [(set_attr "type" "fpcvt")])
  2034.  
  2035. (define_insn "addxf3"
  2036.   [(set (match_operand:XF 0 "register_operand" "=f")
  2037.     (plus:XF (match_operand:XF 1 "nonmemory_operand" "%fGH")
  2038.          (match_operand:XF 2 "nonmemory_operand" "fGH")))]
  2039.   "TARGET_NUMERICS"
  2040.   "addr    %1,%2,%0"
  2041.   [(set_attr "type" "fpadd")])
  2042.  
  2043. (define_insn "subxf3"
  2044.   [(set (match_operand:XF 0 "register_operand" "=f")
  2045.     (minus:XF (match_operand:XF 1 "nonmemory_operand" "fGH")
  2046.           (match_operand:XF 2 "nonmemory_operand" "fGH")))]
  2047.   "TARGET_NUMERICS"
  2048.   "subr    %2,%1,%0"
  2049.   [(set_attr "type" "fpadd")])
  2050.  
  2051. (define_insn "mulxf3"
  2052.   [(set (match_operand:XF 0 "register_operand" "=f")
  2053.     (mult:XF (match_operand:XF 1 "nonmemory_operand" "%fGH")
  2054.          (match_operand:XF 2 "nonmemory_operand" "fGH")))]
  2055.   "TARGET_NUMERICS"
  2056.   "mulr    %1,%2,%0"
  2057.   [(set_attr "type" "fpmul")])
  2058.  
  2059. (define_insn "divxf3"
  2060.   [(set (match_operand:XF 0 "register_operand" "=f")
  2061.     (div:XF (match_operand:XF 1 "nonmemory_operand" "fGH")
  2062.         (match_operand:XF 2 "nonmemory_operand" "fGH")))]
  2063.   "TARGET_NUMERICS"
  2064.   "divr    %2,%1,%0"
  2065.   [(set_attr "type" "fpdiv")])
  2066.  
  2067. (define_insn "negxf2"
  2068.   [(set (match_operand:XF 0 "register_operand" "=f")
  2069.     (neg:XF (match_operand:XF 1 "register_operand" "f")))]
  2070.   "TARGET_NUMERICS"
  2071.   "subr    %1,0f0.0,%0"
  2072.   [(set_attr "type" "fpadd")])
  2073.  
  2074. (define_insn "absxf2"
  2075.   [(set (match_operand:XF 0 "register_operand" "=f")
  2076.     (abs:XF (match_operand:XF 1 "register_operand" "f")))]
  2077.   "(TARGET_NUMERICS)"
  2078.   "cpysre    %1,0f0.0,%0"
  2079.   [(set_attr "type" "fpmove")])
  2080.  
  2081. ;; Arithmetic shift instructions.
  2082.  
  2083. ;; The shli instruction generates an overflow fault if the sign changes.
  2084. ;; In the case of overflow, it does not give the natural result, it instead
  2085. ;; gives the last shift value before the overflow.  We can not use this
  2086. ;; instruction because gcc thinks that arithmetic left shift and logical
  2087. ;; left shift are identical, and sometimes canonicalizes the logical left
  2088. ;; shift to an arithmetic left shift.  Therefore we must always use the
  2089. ;; logical left shift instruction.
  2090.  
  2091. (define_insn "ashlsi3"
  2092.   [(set (match_operand:SI 0 "register_operand" "=d")
  2093.     (ashift:SI (match_operand:SI 1 "arith_operand" "dI")
  2094.            (match_operand:SI 2 "arith_operand" "dI")))]
  2095.   ""
  2096.   "shlo    %2,%1,%0"
  2097.   [(set_attr "type" "alu2")])
  2098.  
  2099. (define_insn "ashrsi3"
  2100.   [(set (match_operand:SI 0 "register_operand" "=d")
  2101.     (ashiftrt:SI (match_operand:SI 1 "arith_operand" "dI")
  2102.              (match_operand:SI 2 "arith_operand" "dI")))]
  2103.   ""
  2104.   "shri    %2,%1,%0"
  2105.   [(set_attr "type" "alu2")])
  2106.  
  2107. (define_insn "lshrsi3"
  2108.   [(set (match_operand:SI 0 "register_operand" "=d")
  2109.     (lshiftrt:SI (match_operand:SI 1 "arith_operand" "dI")
  2110.            (match_operand:SI 2 "arith_operand" "dI")))]
  2111.   ""
  2112.   "shro    %2,%1,%0"
  2113.   [(set_attr "type" "alu2")])
  2114.  
  2115. ;; Unconditional and other jump instructions.
  2116.  
  2117. (define_insn "jump"
  2118.   [(set (pc)
  2119.     (label_ref (match_operand 0 "" "")))]
  2120.   ""
  2121.   "b    %l0"
  2122.   [(set_attr "type" "branch")])
  2123.  
  2124. (define_insn "indirect_jump"
  2125.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
  2126.   ""
  2127.   "bx    %a0"
  2128.   [(set_attr "type" "branch")])
  2129.  
  2130. (define_insn "tablejump"
  2131.   [(set (pc) (match_operand:SI 0 "register_operand" "d"))
  2132.    (use (label_ref (match_operand 1 "" "")))]
  2133.   ""
  2134.   "bx    (%0)"
  2135.   [(set_attr "type" "branch")])
  2136.  
  2137. ;;- jump to subroutine
  2138.  
  2139. (define_expand "call"
  2140.   [(call (match_operand:SI 0 "memory_operand" "m")
  2141.      (match_operand:SI 1 "immediate_operand" "i"))]
  2142.   ""
  2143.   "
  2144. {
  2145.   emit_insn (gen_call_internal (operands[0], operands[1],
  2146.                 virtual_outgoing_args_rtx));
  2147.   DONE;
  2148. }")
  2149.  
  2150. ;; We need a call saved register allocated for the match_scratch, so we use
  2151. ;; 'l' because all local registers are call saved.
  2152.  
  2153. ;; ??? I would prefer to use a match_scratch here, but match_scratch allocated
  2154. ;; registers can't be used for spills.  In a function with lots of calls,
  2155. ;; local-alloc may allocate all local registers to a match_scratch, leaving
  2156. ;; no local registers available for spills.
  2157.  
  2158. (define_insn "call_internal"
  2159.   [(call (match_operand:SI 0 "memory_operand" "m")
  2160.      (match_operand:SI 1 "immediate_operand" "i"))
  2161.    (use (match_operand:SI 2 "address_operand" "p"))
  2162.    (clobber (reg:SI 19))]
  2163.   ""
  2164.   "* return i960_output_call_insn (operands[0], operands[1], operands[2],
  2165.                    insn);"
  2166.   [(set_attr "type" "call")])
  2167.  
  2168. (define_expand "call_value"
  2169.   [(set (match_operand 0 "register_operand" "=d")
  2170.     (call (match_operand:SI 1 "memory_operand" "m")
  2171.           (match_operand:SI 2 "immediate_operand" "i")))]
  2172.   ""
  2173.   "
  2174. {
  2175.   emit_insn (gen_call_value_internal (operands[0], operands[1], operands[2],
  2176.                       virtual_outgoing_args_rtx));
  2177.   DONE;
  2178. }")
  2179.  
  2180. ;; We need a call saved register allocated for the match_scratch, so we use
  2181. ;; 'l' because all local registers are call saved.
  2182.  
  2183. (define_insn "call_value_internal"
  2184.   [(set (match_operand 0 "register_operand" "=d")
  2185.     (call (match_operand:SI 1 "memory_operand" "m")
  2186.           (match_operand:SI 2 "immediate_operand" "i")))
  2187.    (use (match_operand:SI 3 "address_operand" "p"))
  2188.    (clobber (reg:SI 19))]
  2189.   ""
  2190.   "* return i960_output_call_insn (operands[1], operands[2], operands[3],
  2191.                    insn);"
  2192.   [(set_attr "type" "call")])
  2193.  
  2194. (define_insn "return"
  2195.   [(return)]
  2196.   ""
  2197.   "* return i960_output_ret_insn (insn);"
  2198.   [(set_attr "type" "branch")])
  2199.  
  2200. (define_insn "nop"
  2201.   [(const_int 0)]
  2202.   ""
  2203.   "")
  2204.  
  2205. ;; Various peephole optimizations for multiple-word moves, loads, and stores.
  2206. ;; Multiple register moves.
  2207.  
  2208. ;; Matched 5/28/91
  2209. (define_peephole
  2210.   [(set (match_operand:SI 0 "register_operand" "=r")
  2211.     (match_operand:SI 1 "register_operand" "r"))
  2212.    (set (match_operand:SI 2 "register_operand" "=r")
  2213.     (match_operand:SI 3 "register_operand" "r"))
  2214.    (set (match_operand:SI 4 "register_operand" "=r")
  2215.     (match_operand:SI 5 "register_operand" "r"))
  2216.    (set (match_operand:SI 6 "register_operand" "=r")
  2217.     (match_operand:SI 7 "register_operand" "r"))]
  2218.   "((REGNO (operands[0]) & 3) == 0)
  2219.    && ((REGNO (operands[1]) & 3) == 0)
  2220.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2221.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2222.    && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
  2223.    && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
  2224.    && (REGNO (operands[0]) + 3 == REGNO (operands[6]))
  2225.    && (REGNO (operands[1]) + 3 == REGNO (operands[7]))"
  2226.   "movq    %1,%0")
  2227.  
  2228. ;; Matched 4/17/92
  2229. (define_peephole
  2230.   [(set (match_operand:DI 0 "register_operand" "=r")
  2231.     (match_operand:DI 1 "register_operand" "r"))
  2232.    (set (match_operand:DI 2 "register_operand" "=r")
  2233.     (match_operand:DI 3 "register_operand" "r"))]
  2234.   "((REGNO (operands[0]) & 3) == 0)
  2235.    && ((REGNO (operands[1]) & 3) == 0)
  2236.    && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
  2237.    && (REGNO (operands[1]) + 2 == REGNO (operands[3]))"
  2238.   "movq    %1,%0")
  2239.  
  2240. ;; Matched 4/17/92
  2241. (define_peephole
  2242.   [(set (match_operand:DI 0 "register_operand" "=r")
  2243.     (match_operand:DI 1 "register_operand" "r"))
  2244.    (set (match_operand:SI 2 "register_operand" "=r")
  2245.     (match_operand:SI 3 "register_operand" "r"))
  2246.    (set (match_operand:SI 4 "register_operand" "=r")
  2247.     (match_operand:SI 5 "register_operand" "r"))]
  2248.   "((REGNO (operands[0]) & 3) == 0)
  2249.    && ((REGNO (operands[1]) & 3) == 0)
  2250.    && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
  2251.    && (REGNO (operands[1]) + 2 == REGNO (operands[3]))
  2252.    && (REGNO (operands[0]) + 3 == REGNO (operands[4]))
  2253.    && (REGNO (operands[1]) + 3 == REGNO (operands[5]))"
  2254.   "movq    %1,%0")
  2255.  
  2256. ;; Matched 4/17/92
  2257. (define_peephole
  2258.   [(set (match_operand:SI 0 "register_operand" "=r")
  2259.     (match_operand:SI 1 "register_operand" "r"))
  2260.    (set (match_operand:SI 2 "register_operand" "=r")
  2261.     (match_operand:SI 3 "register_operand" "r"))
  2262.    (set (match_operand:DI 4 "register_operand" "=r")
  2263.     (match_operand:DI 5 "register_operand" "r"))]
  2264.   "((REGNO (operands[0]) & 3) == 0)
  2265.    && ((REGNO (operands[1]) & 3) == 0)
  2266.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2267.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2268.    && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
  2269.    && (REGNO (operands[1]) + 2 == REGNO (operands[5]))"
  2270.   "movq    %1,%0")
  2271.  
  2272. ;; Matched 4/17/92
  2273. (define_peephole
  2274.   [(set (match_operand:DI 0 "register_operand" "=r")
  2275.     (match_operand:DI 1 "register_operand" "r"))
  2276.    (set (match_operand:SI 2 "register_operand" "=r")
  2277.     (match_operand:SI 3 "register_operand" "r"))]
  2278.   "((REGNO (operands[0]) & 3) == 0)
  2279.    && ((REGNO (operands[1]) & 3) == 0)
  2280.    && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
  2281.    && (REGNO (operands[1]) + 2 == REGNO (operands[3]))"
  2282.   "movt    %1,%0")
  2283.  
  2284. ;; Matched 5/28/91
  2285. (define_peephole
  2286.   [(set (match_operand:SI 0 "register_operand" "=r")
  2287.     (match_operand:SI 1 "register_operand" "r"))
  2288.    (set (match_operand:SI 2 "register_operand" "=r")
  2289.     (match_operand:SI 3 "register_operand" "r"))
  2290.    (set (match_operand:SI 4 "register_operand" "=r")
  2291.     (match_operand:SI 5 "register_operand" "r"))]
  2292.   "((REGNO (operands[0]) & 3) == 0)
  2293.    && ((REGNO (operands[1]) & 3) == 0)
  2294.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2295.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2296.    && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
  2297.    && (REGNO (operands[1]) + 2 == REGNO (operands[5]))"
  2298.   "movt    %1,%0")
  2299.  
  2300. ;; Matched 5/28/91
  2301. (define_peephole
  2302.   [(set (match_operand:SI 0 "register_operand" "=r")
  2303.     (match_operand:SI 1 "register_operand" "r"))
  2304.    (set (match_operand:SI 2 "register_operand" "=r")
  2305.     (match_operand:SI 3 "register_operand" "r"))]
  2306.   "((REGNO (operands[0]) & 1) == 0)
  2307.    && ((REGNO (operands[1]) & 1) == 0)
  2308.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2309.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))"
  2310.   "movl    %1,%0")
  2311.  
  2312. ; Multiple register loads.
  2313.  
  2314. ;; Matched 6/15/91
  2315. (define_peephole
  2316.   [(set (match_operand:SI 0 "register_operand" "=r")
  2317.     (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
  2318.              (match_operand:SI 2 "immediate_operand" "n"))))
  2319.    (set (match_operand:SI 3 "register_operand" "=r")
  2320.     (mem:SI (plus:SI (match_dup 1)
  2321.              (match_operand:SI 4 "immediate_operand" "n"))))
  2322.    (set (match_operand:SI 5 "register_operand" "=r")
  2323.     (mem:SI (plus:SI (match_dup 1)
  2324.              (match_operand:SI 6 "immediate_operand" "n"))))
  2325.    (set (match_operand:SI 7 "register_operand" "=r")
  2326.     (mem:SI (plus:SI (match_dup 1)
  2327.              (match_operand:SI 8 "immediate_operand" "n"))))]
  2328.   "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
  2329.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2330.    && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
  2331.    && (REGNO (operands[1]) != REGNO (operands[3]))
  2332.    && (REGNO (operands[0]) + 2 == REGNO (operands[5]))
  2333.    && (REGNO (operands[1]) != REGNO (operands[5]))
  2334.    && (REGNO (operands[0]) + 3 == REGNO (operands[7]))
  2335.    && (INTVAL (operands[2]) + 4 == INTVAL (operands[4]))
  2336.    && (INTVAL (operands[2]) + 8 == INTVAL (operands[6]))
  2337.    && (INTVAL (operands[2]) + 12 == INTVAL (operands[8])))"
  2338.   "ldq    %2(%1),%0")
  2339.  
  2340. ;; Matched 5/28/91
  2341. (define_peephole
  2342.   [(set (match_operand:DF 0 "register_operand" "=d")
  2343.     (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
  2344.              (match_operand:SI 2 "immediate_operand" "n"))))
  2345.    (set (match_operand:DF 3 "register_operand" "=d")
  2346.     (mem:DF (plus:SI (match_dup 1)
  2347.              (match_operand:SI 4 "immediate_operand" "n"))))]
  2348.   "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
  2349.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2350.    && (REGNO (operands[0]) + 2 == REGNO (operands[3]))
  2351.    && (REGNO (operands[1]) != REGNO (operands[3]))
  2352.    && (INTVAL (operands[2]) + 8 == INTVAL (operands[4])))"
  2353.   "ldq    %2(%1),%0")
  2354.  
  2355. ;; Matched 1/24/92
  2356. (define_peephole
  2357.   [(set (match_operand:DI 0 "register_operand" "=d")
  2358.     (mem:DI (plus:SI (match_operand:SI 1 "register_operand" "d")
  2359.              (match_operand:SI 2 "immediate_operand" "n"))))
  2360.    (set (match_operand:DI 3 "register_operand" "=d")
  2361.     (mem:DI (plus:SI (match_dup 1)
  2362.              (match_operand:SI 4 "immediate_operand" "n"))))]
  2363.   "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
  2364.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2365.    && (REGNO (operands[0]) + 2 == REGNO (operands[3]))
  2366.    && (REGNO (operands[1]) != REGNO (operands[3]))
  2367.    && (INTVAL (operands[2]) + 8 == INTVAL (operands[4])))"
  2368.   "ldq    %2(%1),%0")
  2369.  
  2370. ;; Matched 4/17/92
  2371. (define_peephole
  2372.   [(set (match_operand:SI 0 "register_operand" "=d")
  2373.     (mem:SI (match_operand:SI 1 "register_operand" "d")))
  2374.    (set (match_operand:SI 2 "register_operand" "=d")
  2375.     (mem:SI (plus:SI (match_dup 1)
  2376.              (match_operand:SI 3 "immediate_operand" "n"))))
  2377.    (set (match_operand:SI 4 "register_operand" "=d")
  2378.     (mem:SI (plus:SI (match_dup 1)
  2379.              (match_operand:SI 5 "immediate_operand" "n"))))
  2380.    (set (match_operand:SI 6 "register_operand" "=d")
  2381.     (mem:SI (plus:SI (match_dup 1)
  2382.              (match_operand:SI 7 "immediate_operand" "n"))))]
  2383.   "(i960_si_ti (operands[1], 0) && ((REGNO (operands[0]) & 3) == 0)
  2384.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2385.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2386.    && (REGNO (operands[1]) != REGNO (operands[2]))
  2387.    && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
  2388.    && (REGNO (operands[1]) != REGNO (operands[4]))
  2389.    && (REGNO (operands[0]) + 3 == REGNO (operands[6]))
  2390.    && (INTVAL (operands[3]) == 4)
  2391.    && (INTVAL (operands[5]) == 8)
  2392.    && (INTVAL (operands[7]) == 12))"
  2393.   "ldq    (%1),%0")
  2394.  
  2395. ;; Matched 5/28/91
  2396. (define_peephole
  2397.   [(set (match_operand:SI 0 "register_operand" "=d")
  2398.     (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d")
  2399.              (match_operand:SI 2 "immediate_operand" "n"))))
  2400.    (set (match_operand:SI 3 "register_operand" "=d")
  2401.     (mem:SI (plus:SI (match_dup 1)
  2402.              (match_operand:SI 4 "immediate_operand" "n"))))
  2403.    (set (match_operand:SI 5 "register_operand" "=d")
  2404.     (mem:SI (plus:SI (match_dup 1)
  2405.              (match_operand:SI 6 "immediate_operand" "n"))))]
  2406.   "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
  2407.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2408.    && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
  2409.    && (REGNO (operands[1]) != REGNO (operands[3]))
  2410.    && (REGNO (operands[0]) + 2 == REGNO (operands[5]))
  2411.    && (INTVAL (operands[2]) + 4 == INTVAL (operands[4]))
  2412.    && (INTVAL (operands[2]) + 8 == INTVAL (operands[6])))"
  2413.   "ldt    %2(%1),%0")
  2414.  
  2415. ;; Matched 6/15/91
  2416. (define_peephole
  2417.   [(set (match_operand:SI 0 "register_operand" "=d")
  2418.     (mem:SI (match_operand:SI 1 "register_operand" "d")))
  2419.    (set (match_operand:SI 2 "register_operand" "=d")
  2420.     (mem:SI (plus:SI (match_dup 1)
  2421.              (match_operand:SI 3 "immediate_operand" "n"))))
  2422.    (set (match_operand:SI 4 "register_operand" "=d")
  2423.     (mem:SI (plus:SI (match_dup 1)
  2424.              (match_operand:SI 5 "immediate_operand" "n"))))]
  2425.   "(i960_si_ti (operands[1], 0) && ((REGNO (operands[0]) & 3) == 0)
  2426.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2427.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2428.    && (REGNO (operands[1]) != REGNO (operands[2]))
  2429.    && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
  2430.    && (INTVAL (operands[3]) == 4)
  2431.    && (INTVAL (operands[5]) == 8))"
  2432.   "ldt    (%1),%0")
  2433.  
  2434. ;; Matched 5/28/91
  2435. (define_peephole
  2436.   [(set (match_operand:SI 0 "register_operand" "=d")
  2437.     (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d")
  2438.              (match_operand:SI 2 "immediate_operand" "n"))))
  2439.    (set (match_operand:SI 3 "register_operand" "=d")
  2440.     (mem:SI (plus:SI (match_dup 1)
  2441.              (match_operand:SI 4 "immediate_operand" "n"))))]
  2442.   "(i960_si_di (operands[1], operands[2]) && ((REGNO (operands[0]) & 1) == 0)
  2443.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2444.    && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
  2445.    && (INTVAL (operands[2]) + 4 == INTVAL (operands[4])))"
  2446.   "ldl    %2(%1),%0")
  2447.  
  2448. ;; Matched 5/28/91
  2449. (define_peephole
  2450.   [(set (match_operand:SI 0 "register_operand" "=d")
  2451.     (mem:SI (match_operand:SI 1 "register_operand" "d")))
  2452.    (set (match_operand:SI 2 "register_operand" "=d")
  2453.     (mem:SI (plus:SI (match_dup 1)
  2454.              (match_operand:SI 3 "immediate_operand" "n"))))]
  2455.   "(i960_si_di (operands[1], 0) && ((REGNO (operands[0]) & 1) == 0)
  2456.    && (REGNO (operands[1]) != REGNO (operands[0]))
  2457.    && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
  2458.    && (INTVAL (operands[3]) == 4))"
  2459.   "ldl    (%1),%0")
  2460.  
  2461. ; Multiple register stores.
  2462.  
  2463. ;; Matched 5/28/91
  2464. (define_peephole
  2465.   [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
  2466.              (match_operand:SI 1 "immediate_operand" "n")))
  2467.     (match_operand:SI 2 "register_operand" "d"))
  2468.    (set (mem:SI (plus:SI (match_dup 0)
  2469.              (match_operand:SI 3 "immediate_operand" "n")))
  2470.     (match_operand:SI 4 "register_operand" "d"))
  2471.    (set (mem:SI (plus:SI (match_dup 0)
  2472.              (match_operand:SI 5 "immediate_operand" "n")))
  2473.     (match_operand:SI 6 "register_operand" "d"))
  2474.    (set (mem:SI (plus:SI (match_dup 0)
  2475.              (match_operand:SI 7 "immediate_operand" "n")))
  2476.     (match_operand:SI 8 "register_operand" "d"))]
  2477.   "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
  2478.    && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
  2479.    && (REGNO (operands[2]) + 2 == REGNO (operands[6]))
  2480.    && (REGNO (operands[2]) + 3 == REGNO (operands[8]))
  2481.    && (INTVAL (operands[1]) + 4 == INTVAL (operands[3]))
  2482.    && (INTVAL (operands[1]) + 8 == INTVAL (operands[5]))
  2483.    && (INTVAL (operands[1]) + 12 == INTVAL (operands[7])))"
  2484.   "stq    %2,%1(%0)")
  2485.  
  2486. ;; Matched 6/16/91
  2487. (define_peephole
  2488.   [(set (mem:DF (plus:SI (match_operand:SI 0 "register_operand" "d")
  2489.              (match_operand:SI 1 "immediate_operand" "n")))
  2490.     (match_operand:DF 2 "register_operand" "d"))
  2491.    (set (mem:DF (plus:SI (match_dup 0)
  2492.              (match_operand:SI 3 "immediate_operand" "n")))
  2493.     (match_operand:DF 4 "register_operand" "d"))]
  2494.   "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
  2495.    && (REGNO (operands[2]) + 2 == REGNO (operands[4]))
  2496.    && (INTVAL (operands[1]) + 8 == INTVAL (operands[3])))"
  2497.   "stq    %2,%1(%0)")
  2498.  
  2499. ;; Matched 4/17/92
  2500. (define_peephole
  2501.   [(set (mem:DI (plus:SI (match_operand:SI 0 "register_operand" "d")
  2502.              (match_operand:SI 1 "immediate_operand" "n")))
  2503.     (match_operand:DI 2 "register_operand" "d"))
  2504.    (set (mem:DI (plus:SI (match_dup 0)
  2505.              (match_operand:SI 3 "immediate_operand" "n")))
  2506.     (match_operand:DI 4 "register_operand" "d"))]
  2507.   "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
  2508.    && (REGNO (operands[2]) + 2 == REGNO (operands[4]))
  2509.    && (INTVAL (operands[1]) + 8 == INTVAL (operands[3])))"
  2510.   "stq    %2,%1(%0)")
  2511.  
  2512. ;; Matched 1/23/92
  2513. (define_peephole
  2514.   [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
  2515.     (match_operand:SI 1 "register_operand" "d"))
  2516.    (set (mem:SI (plus:SI (match_dup 0)
  2517.              (match_operand:SI 2 "immediate_operand" "n")))
  2518.     (match_operand:SI 3 "register_operand" "d"))
  2519.    (set (mem:SI (plus:SI (match_dup 0)
  2520.              (match_operand:SI 4 "immediate_operand" "n")))
  2521.     (match_operand:SI 5 "register_operand" "d"))
  2522.    (set (mem:SI (plus:SI (match_dup 0)
  2523.              (match_operand:SI 6 "immediate_operand" "n")))
  2524.     (match_operand:SI 7 "register_operand" "d"))]
  2525.   "(i960_si_ti (operands[0], 0) && ((REGNO (operands[1]) & 3) == 0)
  2526.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2527.    && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
  2528.    && (REGNO (operands[1]) + 3 == REGNO (operands[7]))
  2529.    && (INTVAL (operands[2]) == 4)
  2530.    && (INTVAL (operands[4]) == 8)
  2531.    && (INTVAL (operands[6]) == 12))"
  2532.   "stq    %1,(%0)")
  2533.  
  2534. ;; Matched 5/29/91
  2535. (define_peephole
  2536.   [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
  2537.              (match_operand:SI 1 "immediate_operand" "n")))
  2538.     (match_operand:SI 2 "register_operand" "d"))
  2539.    (set (mem:SI (plus:SI (match_dup 0)
  2540.              (match_operand:SI 3 "immediate_operand" "n")))
  2541.     (match_operand:SI 4 "register_operand" "d"))
  2542.    (set (mem:SI (plus:SI (match_dup 0)
  2543.              (match_operand:SI 5 "immediate_operand" "n")))
  2544.     (match_operand:SI 6 "register_operand" "d"))]
  2545.   "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
  2546.    && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
  2547.    && (REGNO (operands[2]) + 2 == REGNO (operands[6]))
  2548.    && (INTVAL (operands[1]) + 4 == INTVAL (operands[3]))
  2549.    && (INTVAL (operands[1]) + 8 == INTVAL (operands[5])))"
  2550.   "stt    %2,%1(%0)")
  2551.  
  2552. ;; Matched 5/29/91
  2553. (define_peephole
  2554.   [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
  2555.     (match_operand:SI 1 "register_operand" "d"))
  2556.    (set (mem:SI (plus:SI (match_dup 0)
  2557.              (match_operand:SI 2 "immediate_operand" "n")))
  2558.     (match_operand:SI 3 "register_operand" "d"))
  2559.    (set (mem:SI (plus:SI (match_dup 0)
  2560.              (match_operand:SI 4 "immediate_operand" "n")))
  2561.     (match_operand:SI 5 "register_operand" "d"))]
  2562.   "(i960_si_ti (operands[0], 0) && ((REGNO (operands[1]) & 3) == 0)
  2563.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2564.    && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
  2565.    && (INTVAL (operands[2]) == 4)
  2566.    && (INTVAL (operands[4]) == 8))"
  2567.   "stt    %1,(%0)")
  2568.  
  2569. ;; Matched 5/28/91
  2570. (define_peephole
  2571.   [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
  2572.              (match_operand:SI 1 "immediate_operand" "n")))
  2573.     (match_operand:SI 2 "register_operand" "d"))
  2574.    (set (mem:SI (plus:SI (match_dup 0)
  2575.              (match_operand:SI 3 "immediate_operand" "n")))
  2576.     (match_operand:SI 4 "register_operand" "d"))]
  2577.   "(i960_si_di (operands[0], operands[1]) && ((REGNO (operands[2]) & 1) == 0)
  2578.    && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
  2579.    && (INTVAL (operands[1]) + 4 == INTVAL (operands[3])))"
  2580.   "stl    %2,%1(%0)")
  2581.  
  2582. ;; Matched 5/28/91
  2583. (define_peephole
  2584.   [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
  2585.     (match_operand:SI 1 "register_operand" "d"))
  2586.    (set (mem:SI (plus:SI (match_dup 0)
  2587.              (match_operand:SI 2 "immediate_operand" "n")))
  2588.     (match_operand:SI 3 "register_operand" "d"))]
  2589.   "(i960_si_di (operands[0], 0) && ((REGNO (operands[1]) & 1) == 0)
  2590.    && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
  2591.    && (INTVAL (operands[2]) == 4))"
  2592.   "stl    %1,(%0)")
  2593.